Tuesday, January 26, 2010
How to get workflow instance for single workflow into listitem
Getting access denied error while updating list items
CODE:
//code line for updating list columns
Listitem.update()
List.Update()
After doing debugging and removing line by line from actual code I have figured out actual problem – the user who has contributor rights(normal user) was getting access denied error, admin users can able to update list without any problem, it’s because of LIST.UPDATE() statement, because contributor rights users don’t have permission to change anything into List settings, they can add/delete list items but they can’t able to change anything into list, after removing LIST.UPDATE() statement from my actual code, all users were able to successfully update the list items.
Enjoy!
How to get current status of workflow from SharePoint object model
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;
Wednesday, December 16, 2009
How to open any documents in EDIT Mode from custom ASPX page
We need to display documents from SharePoint Document Library into custom ASPX page and when user clicks on documents, it needs to open in “EDIT” mode, by default it’s giving user prompt to open documents in “EDIT” or “READ” only mode.
Solution:
We need to put extra JavaScript code which will open document in EDIT mode.
Reference Links:
http://ddkonline.blogspot.com/2007/07/issues-with-sharepoint-2007-checkout.html
http://www.google.com/search?q=dispex+sharepoint
http://mattknott.com/content/blog/2009/08/Stop_DispEx_Redirecting.html
http://dotnetninja.wordpress.com/2009/01/12/how-to-open-sharepoint-documents-in-edit-mode-with-internet-explorer-6-and-windows-xp-without-regfix/
Sunday, July 26, 2009
Error: Invalid data has been used to update the list item. The field you are trying to update may be read only.
Actually we need to pass and assigned value into specific format to people and group data type, below link describes very good and precise information on how to get values from SharePoint people picker control and update into list columns having people data type.
http://dishashah.wordpress.com/2009/06/18/how-to-display-users-to-sharepoint-peoplepicker-and-to-get-data-from-sharepoint-peoplepicker/
Enjoy!!
Monday, July 20, 2009
Error while updating SharePoint list, “The security validation for this page is invalid. Click Back in your Web browser, refresh the page, and try your operation again”
Sample Code:
Web.AllowUnsafeUpdates = true;
item["Title"]=”Sample”;
item.Update();
Happy Coding !!
Error while updating list items "Cannot complete this action. Please try again."
Enjoy!!
Wednesday, June 10, 2009
SharePoint web services – permission for GetWebCollection method
So I have used WEBS and LISTS web service to get my required results, while working with WEBS web service, I used web method GetWebCollection() from WEBS web service to take all the web site name underneath one SharePoint web site, the windows application runs well for development sites but for production sites it’s giving me unauthorized access error while accessing GetWebCollection() method, because I don’t have sufficient rights into product site, I was thinking that for executing GetWebCollection() method, I need service account or extra full control rights, but after finding from the internet, I had conclude that I just need “contributor” rights into all sites and sub-sites while working with GetWebCollection() method.
User needs “browse directories” permission.
Reference Link:
http://www.novolocus.com/2008/07/03/browse-directories-and-webs-getwebcollection-strangeness/
From my point of view, we can do all things with SharePoint web services which we can achieve from SharePoint object model, just we need to know which web services and web method to call.
Happy coding !!
Sizes and items limitation for SharePoint List objects
1. Recommended limitation for SharePoint site objects
http://technet.microsoft.com/en-us/library/cc287790.aspx
2. Limitation guidelines for SharePoint 2003 and SharePoint 2007
http://www.sperto.com.ar/fs_files/user_img/articulos/SharePoint%20Limits.pdf
Apart from this article discussion, here is very good link which will describes logical architecture of site collection.
http://www.sharepointblogs.com/llowevad/archive/2007/06/25/site-collection-logical-architecture.aspx
Tuesday, May 5, 2009
Limitation of SharePoint Designer(SPD) Workflow
- We don’t have facility to send BCC email to any person from “Send an Email” actions.
- We can’t bind and attach more then one list into designer workflow, though there are some manual steps from where we can fulfill our requirements, but there won’t be any easy steps from interface or GUI
- We can’t deploy/copy our designer workflow from one server to another server like there won’t be any easy way to deploy SPD workflow from development machine to TEST and Production Server; I’ll write how to do manual steps to achieve this functionality. here is my post regarding how to deploy designer workflow ...
- Designer Workflow don’t give us full customized editor from where we can customized our email body text, to do this, we need to write static HTML tags into email body part.
- We don’t write any calculation fields or formulas into Designer Workflow actions items, like I can’t extract only date from date-time column into designer workflow interface, for this I need to take one extra column into my SharePoint list and need to manipulate into designer workflow.
- While working in “Send an Email” action, if we add any list column from adding “Add Lookup to Body” button and if that column don’t have any values into SharePoint list, then it’s shows as ?????? instead of blank values into email body while sending emails …
I’ll update above lists as per my experience with designer workflow.
SharePoint Designer (SPD) Workflow
Good link to start with SPD Workflow – how to send email with list columns
http://rshelton.com/archive/2007/10/05/sharepoint-document-workflow-quothow-toquot---sending-an-email-with.aspx
How to change task list for auto generated tasks for SPD Workflow
http://www.sharepointblogs.com/tbone/archive/2008/01/10/ode-to-joy-changing-the-task-list-for-auto-generated-tasks-within-sharepoint-designer.aspx
http://nickgrattan.wordpress.com/2008/04/29/changing-the-task-list-for-sharepoint-designer-workflows/
Applying SPD Workflow to multiple lists
http://nickgrattan.wordpress.com/2007/10/17/applying-a-sharepoint-designer-workflow-to-multiple-lists/
Best link which will describe how to “collect data from user” action activity
http://office.microsoft.com/en-us/sharepointdesigner/HA102098081033.aspx
Good information for how to send email with customize email message, hyperlink into with SPD Workflow
http://office.microsoft.com/en-us/sharepointdesigner/HA102390421033.aspx
How to find GUID of SharePoint list
Go to respective List – >Click on Settings Menu – > Click on List Settings Link- > here in this list settings page, we can find many links, we need to click on “Audience targeting settings” link.
Now, currently we are in Audience targeting page, look up at the URL of current audience target page, that the current address have GUID of list, at the end of URL we can find GUID, like ?List={552bef05-b62c-4c76-a217-35e85a1507f1}
Thursday, March 19, 2009
Challenges and limitation while saving list as template from SharePoint GUI
I have found some limitation when I was tried to create new list from existing list template from SharePoint GUI, suppose we have 2 list and one list has lookup column associated with second list column, now we are saving or exporting both list as template and including content to migrate both list from one server to another server, when we are creating new list from saved template, at that time, we are not able to see lookup column values into first list and we are getting error “One or more field types are not installed properly. Go to the list settings page to delete these fields”
Resolution:
I need to go into first list and again map lookup column from second list column, because while migrating list from SharePoint GUI, it didn’t keep column relationship mapping. By using 3rd party tool like AvePoint for list migration, we won’t face such type of error. We can also write custom code to migrate list from one server to another server.
Friday, March 13, 2009
Data view web part – rich HTML text problems/output caching
While working in Data View web part, I have placed user name column into my data view web part, but by default, it displayed some rich text HTML into page, in this case, we need to disable output caching for web part, so for this, we need to put disable-output-escaping="yes" tag into XSL.
e.g. <xsl:value-of select="@fieldname" “disable-output-escaping="yes">
http://blogs.msdn.com/sharepointdesigner/archive/2008/09/20/using-disable-output-escaping-in-data-view.aspx how to disable output caching in data view web part.
Problem with "doctype" column name into SharePoint List
I was faced problem with column name “doctype”, I was not able to create “doctype” column with any of the data type into SharePoint List, and I was getting “Unknown error” into my page when I tried to create column. I tried to find the solution on the internet for some time, but I didn’t get good information, I believe that “doctype” column name is reserved for internal purpose, so we can’t use same name like ID, title column name.
Luckily I was able to create “doctype” as single line of text data type, now the actual problem started, I was not able to delete “doctype” column from SharePoint list, definitely we can write custom code and delete same column from code. But I have found easy way to delete “doctype” column from going to tool called “SharePoint Manager 2007” and I have selected my site-> list -> “doctype” column and delete from that tool. You can find more information regarding SharePoint manager 2007 from my blog, here is link http://sanketinfo.wordpress.com/2008/10/15/sharepoint-manager-2007-%e2%80%93-administration-tool/
Now if we have requirements to create “doctype” into list, then we can create same column name by changing character case. “doctype” column name is case-sensitive, like we can create column with named “DocType”
Monday, October 20, 2008
Fetch list item using SPQuery
Data Grid web part and Back color of Submit button quickly without much changes into code, so for finishing task quickly he approach below steps.
Normally we can keep all configuration values of project in web.config file to avoid deployment in small change cases.
The second way to do it is to keep these values in SharePoint List (values like Some display name
(webpart title, column header text, etc), color).
Example :
I have list with following 4 columns : Title, ElementID, Language, ElementType
In code, we can get any parameter value by calling the following function :
string webPartTitle = queryForName("ContractDetails_WebPart","WebPartTitle", "en").ToString();
This is very helpful technique in terms of small display changes because it removes overheads of going in the code again and deploying again.
public static string queryForName(string Keyword, string Type, string Language)
{
string Name = string.Empty;
SPWeb currentWeb = SPContext.Current.Web;
try
{
SPList elementList = currentWeb.Lists[_ElementList];
string queryString = "<Where><And><And><Eq><FieldRef Name=\"ElementID\" /><Value
Type=\"Text\">" + Keyword + "</Value></Eq><Eq><FieldRef Name=\"ElementType\" /><Value Type=\"Lookup\">" + Type +"</Value></Eq></And><Eq><FieldRef Name=\"Language\" /><Value
Type=\"Lookup\">" + Language + "</Value></Eq></And></Where>";
SPQuery query = new SPQuery();
query.Query = queryString;
SPListItemCollection results;
results = elementList.GetItems(query);
int itemsReturned = results.Count;
if (itemsReturned == 1)
{
foreach (SPListItem result in results)
{
Name = result[_ElementContent].ToString();
break;
}
}
else
{
Name = "";
}
return Name;
}
catch (Exception ex)
{
return Name;
}
}