Tag Archives: c#

Complete SharePoint tasks via Email using Exchange Web Services (Microsoft Exchange Web Services Managed API 2.0)

Sometimes it is a pain that you want to complete a SharePoint task but you are not on your company’s network or connected via VPN. This blog shows you how you can send an email to a mailbox to complete … Continue reading

Posted in EWS, SharePoint 2010, SharePoint Designer 2010, Visual Studio 2010, Web Service | Tagged , , | Leave a comment

SharePoint Event Receiver Does Not Fire

1. Add Trace Log to see if it is really not firing: string now = DateTime.Now.ToString(“ddMMyyyy-HHmmss”); // Creates the text file that the trace listener will write to. System.IO.FileStream myTraceLog = new System.IO.FileStream(“C:\\temp\\SharePoint Trace Log\\” + now + “.txt”, System.IO.FileMode.OpenOrCreate); … Continue reading

Posted in Event Receiver, SharePoint 2010, Visual Studio 2010 | Tagged , , | Leave a comment

Programmatically complete a workflow task

To complete a workflow task programmatically, use the following code (say taskItem is the task you want to complete): taskItem.Web.AllowUnsafeUpdates = true; Hashtable data = new Hashtable(); data[SPBuiltInFieldId.Completed] = “TRUE”; data[SPBuiltInFieldId.PercentComplete] = 1; data[SPBuiltInFieldId.Outcome] = “Completed”; data[SPBuiltInFieldId.TaskStatus] = SPResource.GetString(new CultureInfo((int)taskItem.Web.Language, … Continue reading

Posted in SharePoint 2010, Visual Studio 2010 | Tagged , | Leave a comment

“An entry with the same key already exists” Error

Check if there are duplicated values in a drop down list If you are trying to set more than one option in a drop down list as selected, i.e., item.Selected = true; , you will get this error.

Posted in SharePoint 2010, Visual Studio 2010 | Tagged , | Leave a comment