1: public static bool IsWorkflowRunning(SPListItem item, Guid baseID)
2: {
3: bool isRunning = false;
4:
5: SPWorkflowCollection workflowCol = item.Workflows;
6:
7: var query = from SPWorkflow work in item.Workflows
8: where work.ParentAssociation.BaseId == baseID && (work.InternalState & SPWorkflowState.Running) == SPWorkflowState.Running
9: select work;
10:
11: if (query.Count() > 0)
12: {
13: isRunning = true;
14: }
15:
16: return isRunning;
17: }
Thursday, November 12, 2009
Wednesday, October 7, 2009
Monday, September 21, 2009
SharePoint Manger 2007 For Adding Customized content Type
Hello All,
First let me explain, what is content Type? Its FAQ and very important to understand,
A content type is a reusable collection of settings you want to apply to a certain category of content. Content types enable you to manage the metadata and behaviors of a document or item type in a centralized, reusable way.
for the exact definition visit
http://www.documentmanagementworkflowinfo.com/sharepoint-document-management/understand-basics-content-types-sharepoint.htm
For Customizing the New\Edit\Display Forms of Custom List
use SharePoint Manager which can be downloaded at codeplex
its a great tool for customizing content Types
Find more links on google for how to do it
like 1) http://sharepointmagazine.net/technical/development/customizing-the-user-experience-of-sharepoint-content-type-user-interface-part-4-of-6
2)Book on Share Point Manager 2007
First let me explain, what is content Type? Its FAQ and very important to understand,
A content type is a reusable collection of settings you want to apply to a certain category of content. Content types enable you to manage the metadata and behaviors of a document or item type in a centralized, reusable way.
for the exact definition visit
http://www.documentmanagementworkflowinfo.com/sharepoint-document-management/understand-basics-content-types-sharepoint.htm
For Customizing the New\Edit\Display Forms of Custom List
use SharePoint Manager which can be downloaded at codeplex
its a great tool for customizing content Types
Find more links on google for how to do it
like 1) http://sharepointmagazine.net/technical/development/customizing-the-user-experience-of-sharepoint-content-type-user-interface-part-4-of-6
2)Book on Share Point Manager 2007
Saturday, September 12, 2009
validation with standard sharepoint error Page on ListItem adding event
To add validation to listitem adding event( to restrict the no of items to be added per day)in list
1) Visual studio 2008 -->Sharepoint-->Empty Project
2)In solution explorer-->add new item --> content type
3)And check content type with event receiver, you will find three 2 .cs files and 1 xml file
a)itemeventreciver.cs
b)ListItemReciver.cs
in this file uncomment the ItemAdding event
add the following code required for the restriction
public override void ItemAdding(SPItemEventProperties properties)
{
int perday = GetItemCountPerDay();
string dt= properties.AfterProperties[CONST_FIELD_DATETIME].ToString();
SPQuery query = QueryItemForPerDay(dt);
using (SPWeb oWebsite = new SPSite(properties.SiteId).OpenWeb(properties.RelativeWebUrl))
{
SPListItemCollection collItems = oWebsite.Lists[properties.ListTitle].GetItems(query);
if ((collItems != null) && (collItems.Count > perday - 1))
{
properties.ErrorMessage = String.Format("Adding items to this list is not supported because per day only allowed add {0} items.", PER_DAY);
properties.Cancel = true;
}
}
}
c).xml file
4)Deploy the project
To enable the content type
go to the site Site actions -->create new custom list --> enable the content types for the site
list settings-->advanced settings--selct deployed content type
5)Go to wss --> virtual diectories-> site --> open the web.config file and do the following changes
sharepoint
safemode MaxControls="200" CallStack="false" DirectFileDependencies="10" TotalFileDependencies="50" AllowPageLevelTrace="false"
customerrors mode="On"
1) Visual studio 2008 -->Sharepoint-->Empty Project
2)In solution explorer-->add new item --> content type
3)And check content type with event receiver, you will find three 2 .cs files and 1 xml file
a)itemeventreciver.cs
b)ListItemReciver.cs
in this file uncomment the ItemAdding event
add the following code required for the restriction
public override void ItemAdding(SPItemEventProperties properties)
{
int perday = GetItemCountPerDay();
string dt= properties.AfterProperties[CONST_FIELD_DATETIME].ToString();
SPQuery query = QueryItemForPerDay(dt);
using (SPWeb oWebsite = new SPSite(properties.SiteId).OpenWeb(properties.RelativeWebUrl))
{
SPListItemCollection collItems = oWebsite.Lists[properties.ListTitle].GetItems(query);
if ((collItems != null) && (collItems.Count > perday - 1))
{
properties.ErrorMessage = String.Format("Adding items to this list is not supported because per day only allowed add {0} items.", PER_DAY);
properties.Cancel = true;
}
}
}
c).xml file
4)Deploy the project
To enable the content type
go to the site Site actions -->create new custom list --> enable the content types for the site
list settings-->advanced settings--selct deployed content type
5)Go to wss --> virtual diectories-> site --> open the web.config file and do the following changes
sharepoint
safemode MaxControls="200" CallStack="false" DirectFileDependencies="10" TotalFileDependencies="50" AllowPageLevelTrace="false"
customerrors mode="On"
Friday, May 29, 2009
Sunday, March 22, 2009
Thursday, January 8, 2009
Screencasts for sharepoint developers
1)http://msdn.microsoft.com/hi-in/sharepoint/aa905382(en-us).aspx
Subscribe to:
Posts (Atom)