Pages

Showing posts with label SPListItem. Show all posts
Showing posts with label SPListItem. Show all posts

Tuesday, January 26, 2010

How to get current status of workflow from SharePoint object model

Reference Link:

http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.workflow.spworkflowstatus.aspx

Sample Code:
//Obtain a list item
SPWeb thisWeb = SPControl.GetContextWeb(Context);
SPList issuesList = thisWeb.Lists["Customer Issues"];
SPListItem myItem = issuesList.Items[0];
//Get the workflow status value
int WorkflowStatusValue = myItem["MyWorkflow"];
string WorkflowStatusString = System.Enum.GetName
        (typeof(SPWorkflowStatus), WorkflowStatusValue);
StatusLabel.Text = "The current status of the workflow is: " +
        WorkflowStatusString;

Monday, July 20, 2009

Error while updating list items "Cannot complete this action. Please try again."

I was getting error while updating list items; after looking into each code line by line, I have found that error comes due to incorrect syntax near CAML query, I feel that SharePoint didn’t give us good user friendly error message to debug into our code. After making correction, my code work well.

Enjoy!!

Wednesday, June 10, 2009

Tuesday, October 14, 2008

SPListItem Class

In SharePoint object model, for document library, each item consider as SPListItem in code, like If I have one word document file and one folder then both comes under SPListItem class, but for differentiate purpose we can check SPListItem.ContentType.Name and compare with "folder" type or anything.