Loading...

Sunday, January 10, 2010

Some things in SharePoint .. Should be Known Commonly..



We all know that whenever we add a list item or do some modification, we update the list. Here we have two options:
A)
1)List.Update() creates automatically new version of list
2)List.SystemUpdate()does not create automatically new version of list.


B)SPQuery

To Query for items inside the folder
SPQuery.ViewAttributes = "Scope='Recursive'";
or
SPQuery.ViewAttributes = "Scope='RecursiveAll'
";


C)Adding a Recurring Event to Lists on Multiple Sites


D) To impersonate user checking out a file.

SPSite site = new SPSite("SiteCollection_Url");
SPWeb web = site.OpenWeb();
SPUser user = web.AllUsers["User_Name"];
SPUserToken token = user.UserToken;
SPSite impersonatedSiteCollection = new SPSite("SiteCollection_Url", token);


E)Enabling the Send To Record option Enabled
SPAdministration wp=new SPAdministration();
Uri url=new Uri("//portal/records/_vti_bin/officialfile.asmx")
app.officialFileuri=url;
app.officialFilename="Record";
app.Update();

F)To send the email to site users when item is added to custom list
Write the event handler for ItemAdding event and write following
SPSite site = new SPSite("http://yoursite");
SPWeb web = site.OpenWeb();
SPList lst = web.Lists["Alert Test"];
SPAlert alert = web.Alerts.Add();
alert.AlertFrequency = SPAlertFrequency.Immediate;
alert.AlertType = SPAlertType.List;
alert.EventType = SPEventType.All;
alert.DynamicRecipient = "To";
alert.List = lst;
alert.Status = SPAlertStatus.On;
alert.Title = “Auto Email Alert”;
alert.Filter = "";
alert.Update();


G)A very Nice tool for Workflow aspx forms

H)
a)WSP Builder
b)Creating Custom fields using WSP Builder
c)
Overriding GetvalidateString Method of Custom field for validation


I)Creating site definition in sharepoint
Site definition have following files
ListTemplateID
a)WEBTEMP.XML
Path:- Local_drive:\Program Files\Common Files\Microsoft Shared\Web server extensions\60\TEMPLATE\1033\XML
Description:- Specifies configurations of lists and modules for a site definition.


b)ONET.XML
Path :-Local_drive:\Program Files\Common Files\Microsoft Shared\Web server extensions\60\TEMPLATE\1033\*\XML
Decription:-Defines navigation bars such as the top link bar and the quick launch, available lists, document templates, base types, configurations, modules

c)
SCHEMA.XML

Path :- Local_drive:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\60\TEMPLATE\1033\Custom_Site_Template\LISTS

Decription:-Defines the columns, views, and contents of a list