foreach (SPWorkflow workflow in item.Workflows) { SPWorkflowManager.CancelWorkflow(workflow); }
Monday, February 18, 2013
How to cancel all existing Work Flows on an item
// Terminate all existing In-Progress workflows.
Thursday, February 14, 2013
SharePoint 2010 Workflow cannot compare multiple Person filed
Please note that if the person field is only single user field. The comparison seems to be working. If you want you can write a custom activity to do that.
Thursday, February 7, 2013
how to turn on developer dashboard
Using STSADM
Open a command window to the %ProgramFiles%\Common Files\Microsoft Shared Debug\Web Server Extensions\14\BIN directory and enter one of the following commands, depending on the desired display mode.
Mode
|
Command
|
On
|
stsadm -o setproperty -pn developer-dashboard -pv on
|
OnDemand
|
stsadm -o setproperty -pn developer-dashboard -pv ondemand
|
REF:
http://msdn.microsoft.com/en-us/library/ff512745(v=office.14).aspx
Tuesday, February 5, 2013
How to open SharePoint Page in WebPart Maintenance Mode
Maintenance page can be opened by adding the following query string to the page URL
?contents=1
Wednesday, January 16, 2013
How to move custom List Item to a folder within the list
- $item = $List.GetItemById(1)
- $file = $web.GetFile($item.Url)
- $file.MoveTo($item.ParentList.RootFolder.Url + "/Folder/" + $item.ID +"_.000")
Here is my script sequence.
PS N:\> $item = $List.GetItemById(5)
PS N:\> $item.ResetRoleInheritance()
PS N:\> $file = $web.GetFile($item.Url)
PS N:\> $file.MoveTo($item.ParentList.RootFolder.Url + "/XXFOLDER/" + $item.ID +"_.000")
PS N:\> $item = $List.GetItemById(6)
PS N:\> $item.ResetRoleInheritance()
PS N:\> $file = $web.GetFile($item.Url)
PS N:\> $file.MoveTo($item.ParentList.RootFolder.Url + "/XXFOLDER/" + $item.ID +"_.000")
PS N:\>
Monday, January 14, 2013
Workflow not running when item updated from event receiver.
I finally found the post to solve my problem of having to run workflow from SPItem.Update()
"
workflow's and event handlers run on a different thread than the main thread. You just cannot create another Console/Windows Application and have it trigger the workflow and just quit.
Quitting the application before the asyc worker threads finish their work, causes those threads to simply abort. In case of workflow, it would seem as workflow never fired !!
So what is the fix here? Use the following line of code
SPSite.WorkflowManager.Dispose();
after updating the item. So effectively the overall code becomes:
using(SPSite site = new SPSite(url)) { using(SPWeb web = site.OpenWeb()) { SPList list = web.GetList(url); SPListItem item = list.Items[1]; item[updateField] = DateTime.Now.ToLongDateString(); item.Update(); site.WorkflowManager.Dispose(); } }
Now when I ran the console application, as expected the item updates and the workflow is triggered
"
Source: http://blogs.msdn.com/b/malag/archive/2008/07/11/splistitem-update-not-starting-workflow.aspx
Thursday, January 10, 2013
How to move list items between SharePoint lists
One of the ways for simple list items is as follows.
- Go the folloing link
- (http://<Sharepoint Sites>/_Layouts/sitemanager.aspx)
- Select the items you wish to copy
- Select the Destination list
- Done.
Subscribe to:
Posts (Atom)