Attaching a file to an item using code


If you are using a custom newform.aspx then you will face difficulties in adding attachments. There are two scenariosIf you make your own infopath forms/user control then you will not be having the attachments option If you remove any columns(Default for that list) using sharepoint designer , you will have the option for attachments but... Continue Reading →

Advertisements

Getting value from a XML file of a SPList item


public string GeUserAttributeValue(SPList listCollection, string attributeName,string userName){if (userName == null){userName = this.web.CurrentUser.Name;}for (int count = 0; count }break; } } return strDeptName; } "z", "#RowsetSchema is the namespace used in the XML and hence we add it to the namespace manager.ows_Department is the name of field in XML for the Department field in the list.

Customized error page in Sharepoint


In SharePoint there is not any functionality for displaying our customized error page.Like if for data validation in event/item handler we useproperties.ErrorMessage = “Opps... Not allowed”;properties.Cancel = true;And validation message displayed in SharePoint error Page which looks error in application.But with this Context you can use to redirect to any of your custom or any... Continue Reading →

Session and QueryString in Event Handler


Add System.Web namespace public class MyEventHandler: SPItemEventReceiver { HttpContext current; String requestNumber; public MyEventHandler() { current = HttpContext.Current; requestNumber=Convert.ToString(this.current.Request.QueryString["reqno"]); } public override void ItemAdded(SPItemEventProperties properties) { // code  for event handler goes here } Since event handler methods doesn't have access to the page object we cant access query string and Session values. So you... Continue Reading →

Create a website or blog at WordPress.com

Up ↑

%d bloggers like this: