How to get the context item in Workflow activity (SharePoint)

后端 未结 6 1779
萌比男神i
萌比男神i 2021-02-20 06:56

I am writing custom activity for sharepoint workflow and I don\'t know how I can use current workflow item, SPWeb or SPSite.

I see http://blogs.microsoft.co.il/blogs/dav

6条回答
  •  灰色年华
    2021-02-20 07:35

    Kit Menke's answer is very comprehensive and covers just about all you need: I would only add the following...

    If you do this:

    SPWeb tmpweb = __Context.Web;
    SPSite site = new SPSite(tmpweb.Url);
    SPWeb web = site.OpenWeb();
    

    instead of this:

    SPWeb web = __Context.Web;
    ...
    

    then you are free of the security context passed through to the workflow by the person who triggered it.

提交回复
热议问题