- Executing CAML Query :
SPWeb MyWeb = SPContext.Current.Web;
SPList listDocTypes = MyWeb.Lists["HR Document Type Sub Category"];
Get the list you want to execute query
SPQuery ContentQuery = new SPQuery();
// declaring SPQuery object
ContentQuery.Query = "
//writing Query : is equivalent to select * where 'HRMainCategory' =???
SPListItemCollection items = listDocTypes.GetItems(ContentQuery);
// get the filtered items from List and store it in ListCollectionItems
_DrpDocumentTypeSubCategory.Items.Add("Please Select...");
// iterate and consume items in Drop down
foreach (SPListItem singleItem in items)
{
_DrpDocumentTypeSubCategory.Items.Add(singleItem["HRDocumentTypesSubCategory"].ToString());
}
- Cancelling WorkFlow
using Microsoft.SharePoint.Workflow;
SPList currentList = SPContext.Current.List;
// get current list
SPListItem item = (SPListItem)SPContext.Current.Item;
// get current item
// set item moderation to approved
item.ModerationInformation.Status = SPModerationStatusType.Approved;
item.File.Approve("Already Approved Document");
SPWorkflowManager.CancelWorkflow(item.Workflows[0]);
// cancel the workflow
Kind Regards
No comments:
Post a Comment