Sharepoint Nuances
Thursday, May 23, 2013
Adding Fields tp Contenttypes programatically
The SPContentType object also has a Fields property that returns an SPFieldCollection object. You cannot add columns directly to this collection. When you add an SPFieldLink object to the FieldLinks collection, a corresponding SPField object is added automatically to the Fieldscollection. Each SPField object in this collection represents a "merged view" of the base column definition and any overwritten properties that are specified in the column reference.
http://msdn.microsoft.com/en-us/library/aa543526.aspx
Thursday, May 16, 2013
Helpful writeup about eventhandlers at List/Library level
http://www.synergyonline.com/Blog/Lists/Posts/Post.aspx?ID=122
Wednesday, April 10, 2013
Add/Move ListItems to a folder in SharePoint List, adding folders if needed
/// Adding Items under folder in List
SPList oList = web.Lists["ListName"];
SPListItemCollection items = oList.Items;
SPListItem item = items.Add("/sites/[webname]/Lists/[ListName]/[FolderName]",
SPFileSystemObjectType.File);
item["Title"] = "Something";
item.Update();
///// Moving Listitems to different folder in same list
SPListItemCollection items = oList.Items;
foreach (SPListItem item in items)
{
SPFile file = web.GetFile(item.Url.ToString());
file.MoveTo(string.Format("Lists/[ListName]/{0}/{1}_.000", "FolderName", item["ID"].ToString()));
item.Update();
}
/// Creating Folders if needed
oFolder = oList.Items.Add(oList.RootFolder.ServerRelativeUrl, SPFileSystemObjectType.Folder, FolderName);
newFolder.Update();
oList.Update();
Tuesday, April 9, 2013
Monday, April 8, 2013
SharePoint Best practises
http://msdn.microsoft.com/en-us/library/ee557257.aspx
no offense meant!
Hilarious comment at the bottom, that was just going around in my head.
no offense meant!
Hilarious comment at the bottom, that was just going around in my head.
Tuesday, July 31, 2012
Wednesday, July 18, 2012
Useful Find
http://stackoverflow.com/questions/621777/select-the-next-n-elements-of-an-ienumerablet
Skip() and Take() in Linq can be used to select a certain sequence irrespective of its order.
Skip() and Take() can be used in combination to select a sequence starting anywhere.
Difference between Where() and TakeWhile() is TakeWhile() stops when first negative result is encountered, former does not..
Skip() and Take() in Linq can be used to select a certain sequence irrespective of its order.
Skip() and Take() can be used in combination to select a sequence starting anywhere.
Difference between Where() and TakeWhile() is TakeWhile() stops when first negative result is encountered, former does not..
Subscribe to:
Posts (Atom)