Monday, April 19, 2010

Your changes conflict with those made concurrently by another user. If you want your changes to be applied, click Back in your Web browser.

Today I am facing save conflict problem when i am updating list item during itemupdating event.

I have found solution after Research.

using (SPSite oSiteCollection = new SPSite(properties.WebUrl.ToString()))
{
using (SPWeb oWebsiteRoot = oSiteCollection.OpenWeb())
{
int count = 0;
oWebsiteRoot.AllowUnsafeUpdates = true;

SPList list = oWebsiteRoot.Lists[properties.ListId];
SPListItem oItem = list.GetItemById(properties.ListItemId);
if (oItem["Request_x0020_Counter"] != null && oItem["Request_x0020_Counter"].ToString() != string.Empty)
{
count += Convert.ToInt32(oItem["Request_x0020_Counter"].ToString()) + 1;
}
else
{
count += count + 1;
}
properties.AfterProperties["Request_x0020_Counter"] = count;



}
}

Friday, April 16, 2010

PDF Convertor for SharePoint

Hi Guys,

I have uploaded word to pdf feature in codeplex. Please find attachment in source code tab in below link.

Link : http://word2pdf.codeplex.com/

Thursday, April 15, 2010

Programmatically update workflow history on specific list

using (SPSite site = new SPSite("http://MOSS:5858"))

{

using (Microsoft.SharePoint.SPWeb web = site.OpenWeb())

{



web.AllowUnsafeUpdates = true;

SPList historyList = web.Lists["Workflow History"];

SPListItem item = historyList.Items.Add();



item["Description"] = "testing";

item["WorkflowInstance"] = "{7CF46B1F-42C8-4E0A-80D3-EBEFD670AC63}";



item.Update();

}

}

Programmatically Update Hyperlink in sharepoint list

SPFieldUrlValue linkUrl = new SPFieldUrlValue();
linkUrl.Description = "Completed";
linkUrl.Url = "http://www.google.co.in"
item["WF Status"] = linkUrl;

Saturday, April 10, 2010

MOSS 2007 Script Collection

http://www.powershell.nu/2009/09/08/moss-2007-script-collection/

Monday, April 5, 2010

Errors were found when compiling the workflow.The workflow files were saved but cannot be run.

I have installed third party feature on sharepoint after that this problem is created.

Solution :

Check web.config file authorizedTypes section.