development
20 12 2011
After some time now supporting many others in the use and development of Microsoft SharePoint as a platform, I’ve come to notice some common traits of people who are new to developing solutions. I’ve decided to list the 5 most here, and I hope that these cover both those who are currently developers getting started […]
11 10 2011
Here’s a little snippet of code to grab the MySite host of the current environment using jQuery to pick it out from the user’s Welcome Menu.
|
var str = $('#ID_MySiteMenu').attr('onMenuClick');<br>var myHost = str.substring(str.indexOf('http://'),str.length-2);<br>alert(myHost);<br> |
Nice and simple!
8 10 2011
Disclaimer: The examples shown in this post are extremely unrealistic in terms of real-life scenarios. The numbers and types of fields used in these experiments are designed purely to test the physical limitations of SharePoint. At no point is it suggested that a real-life use of such list architecture be used. If you do have lists […]
9 06 2011
As part of my series on performance, I thought I’d look at updating large (20,000 item) lists in bulk, and what are the fastest ways to do this. I’ve gone through a few different ways of doing this, finding out where the slowness is coming from, and I present the results of the analysis in […]
1 06 2011
After this question was asked on SharePoint Stack Exchange, I thought I’d share my method of re-ordering content types in a list. Note: this isn’t the only method of doing this, see the thread on SPSE to see more (particularly the UniqueContentTypeOrder property).
|
private void ReorderContentTypes(SPWeb web, string listName, string firstContentTypeName)<br>{<br> SPList list = web.Lists[listName];<br><br> SPContentType cType = web.AvailableContentTypes[firstContentTypeName];<br><br> List<SPContentType> oldCTypes = new List<SPContentType>();<br><br> for (int i = list.ContentTypes.Count -1; i >= 0; i--)<br> {<br> if (!list.ContentTypes[i].Id.IsChildOf(cType.Id))<br> {<br> oldCTypes.Add(list.ContentTypes[i]);<br><br> list.ContentTypes[i].Delete();<br> }<br> }<br><br> foreach (SPContentType c in oldCTypes)<br> {<br> list.ContentTypes.Add(c);<br> }<br><br> list.Update();<br>}<br> |
18 04 2011
So you’ve embarked on writing a bit of code that must enumerate a SharePoint List’s Items one by one and do some stuff with them. You’ve (at some point) came across the Best Practices page on MSDN on Handling Large Folders and Lists, and seen that using SPList.Items is bad. It’s bad because you could […]
4 04 2011
Here’s a straight forward one. For some reason (don’t ask) I had to update a content type in a Feature Receiver (I would have preferred to have created a new content type and inherit) by adding a new field to it. Here’s the code, purely for my personal reference but open in case other people […]
2 04 2011
We’re working on a large(ish) project right now in SharePoint 2007 that will quite soon be migrating to SharePoint 2010, so I decided to take the WSPs we’ve had so far (that work fine in 2007) and see how well they’d work in 2010, either as Farm solutions or User (Sandbox) solutions. I came across […]
10 03 2011
Tonight’s little project was inspired by a conversation on Twitter with @WonderLaura and @Toddklindt. Laura had asked about the implications of lots of item-level permissions in a big list in SharePoint (here), to which Todd replied with this, and followed up with this and this. So this got me thinking: where is the performance bottleneck […]
11 02 2011
Had a quick frustration today, that some code I had (bog standard SPWebApplication.Sites.Add) would create a site collection fine but had absolutely no content types or site columns. Both galleries were empty. Lists and Libraries had content types (such as Pages) fine, but SFA in the gallery. If you have this, you’re probably doing what […]