protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext) { SPWeb web = __Context.Web; SPList list = web.Lists[Microsoft.SharePoint.WorkflowActions.Helper.GetListGuid(__Context, ListId)]; SPListItem item = list.Items.GetItemById(__ListItem); SPFolder folder = web.GetFolder(item.Url); if (item.Folder == null) { SPFolder parentFolder = folder.ParentFolder; if (folder.ParentFolder != null && folder.ParentFolder.Exists) { FolderId = new SPItemKey(parentFolder.Item.ID); } else { FolderId = new SPItemKey(); } } else { FolderId = new SPItemKey(item.Folder.ParentFolder.Item.ID); } return(ActivityExecutionStatus.Closed); }
protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext) { SPWeb web = __Context.Web; SPList list = web.Lists[Microsoft.SharePoint.WorkflowActions.Helper.GetListGuid(__Context, ListId)]; SPFolder folder = list.RootFolder; SPFile file = folder.Files.Add(FileName, Encoding.UTF8.GetBytes(Xml), Overwrite); FileItemId = new SPItemKey(file.Item.ID); FileUrl = SPEncode.UrlEncode(web.Url + "/" + file.Url); return(ActivityExecutionStatus.Closed); }