29 01 2014
Jimmywim | Uncategorized |
So it seems that people are beginning to bear the ugly side of hosting solutions on a hosted platform (that you don’t own) – and that’s having the platform updated without being informed! This is all well and good, because the features that Microsoft control are continually being tweaked, and if they don’t work as […]
Office 365
27 08 2013
Trying never to use SPList.Items (due to Best Practice), yet needing to grab some items from a list quite often? Here’s an extension method which I use a fair bit.
|
/// <summary> /// Gets items where a property matches a value /// </summary> /// <param name="list">The list.</param> /// <param name="property">The property.</param> /// <param name="value">The value.</param> /// <returns>A list collection of SPListItems</returns> public static IList<SPListItem> ItemsWhere(this SPList list, string property, string value) { SPQuery query = new SPQuery(); query.Query = string.Format("<Where><Eq><FieldRef Name='{0}' /><Value Type='Text'>{1}</Value></Eq></Where>", property, value); SPListItemCollection items = list.GetItems(query); return items.Cast<SPListItem>().ToList(); } |
You can then use regular LINQ queries to get the item or items you need against the object returned by this, for example:
|
SPList webPartCatalog = site.GetCatalog(SPListTemplateType.WebPartCatalog); SPListItem wpItem = webPartCatalog.ItemsWhere("FileLeafRef", "Some Web Part.dwp").FirstOrDefault(); |
[…]
2 08 2013
Here’s a quickie – in SharePoint Sites and Lists, you have the option to let the search indexer crawl the content, setting the “Allow this site to appear in search results”. This is a property on the relevant object called ‘NoCrawl‘. Just set this to true to prevent indexing of the object, or false to […]
1 08 2013
Scenario: You’ve programmatically provisioned some Content Organizer Rules to send some documents somewhere based on a Managed Metadata Field. When you upload a document and set that field to something matching a condition, it throws an error, and you see this in the event logs:
|
Routing Engine: EvaluateCondition threw an exception. rField: <guid>|<field internal name>|<field title>, objParams[0]: <metadata label>|<term id>, objParams[1]: <wssid>;#<metadata label>|<term id>, condition.ColumnType: Invalid, condition.ColumnName: <field id>|<field internal name>|<field title>, op: Contains |
The thing to watch here is the last bit […]
17 07 2013
There is a relatively unknown yet very powerful and extremely cool API sitting in SharePoint Server since 2010. In my 4 years of using SharePoint 2010, even I only came across this just a couple of weeks ago – Excel Services has a REST API endpoint and a JavaScript API! What’s this mean? It means […]
1 07 2013
So you should’ve heard by now that SharePoint 2013 uses the AppFabric Distributed Caching mechanism to (finally) manage caching across multiple nodes in a SharePoint farm. Awesome. So does that mean you can use it for your custom apps? Absolutely not, according to TechNet: http://technet.microsoft.com/en-us/library/jj219572.aspx If you are using custom applications in SharePoint Server 2013 which […]
17 06 2013
When you try to delete a page layout that’s in use, SharePoint will warn you (or rather, blow up on you) that it’s currently in use, but rather unhelpfully doesn’t tell you which pages are using it. Luckily, a little-known feature in SharePoint that has existed since SharePoint 2007 will list you all the pages […]
13 06 2013
Want to set the Rating for the current page yourself with JavaScript? Here’s how. You will probably need to build your own rating control to get the rating for the current page and render it nicely, but until I figure out the SP JavaScript to update the OOTB control, here’s the code for actually setting […]
3 06 2013
SharePoint 2013 has touted quite a few new features which allegedly ‘enable’ developers from more web design backgrounds to work in the platform. There is an encouragement to use more modern development techniques such as pure JavaScript and HTML to use technologies like REST to develop applications. And fitting in with this trend is the […]
24 05 2013
Cut to the chase: github is here: https://github.com/jimmywim/SPMobileI have spent a bit of time recently tidying up and expanding the code possibilities with my iOS library – SPRESTApi. The changes have allowed me to extend it so it’s no longer just a REST API helper, but can be used to called the ASMX web services in […]