Friday 20 May 2011

SUGUK Southampton Meet

SUGUK South Meeting - Thursday 19th May 2011 http://suguksouth.eventbrite.com/
Thanks to Ian Woodgate for arranging the user group session.  A good close nit user group.  Using Southampton universities facilities is great. On the night we did 3 developer sessions, I got some useful tips and ideas from the other presenters namely: Martin Hatch, Chris McKinley and Darren White.
LINQ to SharePoint Sandbox solution development demo presentation
Ian Woodgate's blog & summary of the evening - http://blog.pointbeyond.com/2011/05/21/sharepoint-uk-user-group-southampton-19-may/
Martin Hatch's blog is: http://www.martinhatch.com/
Chris McKinley's blog: http://crmckinley.sharepointspace.com
Demo Code Download
VS project - create lists & set up referential integrity.
VS project - deploy a visual user control web part via a sandbox solution.
Slide Deck - More detailed

Sunday 15 May 2011

SharePoint Retreat Roundup

Summary of the day:  "Here is my feedback from the SharePoint Retreat meeting on Saturday 14th of May 2011.   9 people were at the retreat. We did 5 hours work and were really pushed for time - the day covered too many areas and needed more time to use the SPRetreat format properly. Venue was good - not exactly central but definately happy with the venue. I thought my presentation went well - only 1 other guy had used LINQ to SP in practice so a good topic choice, the practice exercise went well with everyone sharing however, we ran out of the time and Ashraf was left about an hour to present which he did very well on Info Path 2010 - a lot of the guys knew Infopath 2007 and I think they got a lot out of Ash's session.
My general feeling was the attendees were all glad they came and I believe we all walked away with good information. I think all the guys want to have more of these on a Saturday and guys are volunteering to do sessions. I like the coding katas format but it takes a long time and the day should only address 1 topic. All the guys that attended liked having 1 practice session per topic and the retrospective is great. Doing 2 topics worked well for 5 odd hours which allowed us all to only use up our day to lunch time. But i guess it really depends how in depth one goes on each topic.  
I'm going to open up a dialog with all the attendees and look to do another event in July."
Please post comments on your thoughts of the day - pls suggest topics, format for a July day.   thanks
paul


The videos I recorded came out very poorly, try get better light and equipement next time. 
Video of the slides explaining LINQ to SharePoint on YouTube

SPLINQ - Parameter.xml to show hidden fields

Problem:  I can never remember the syntax for the parameters files and need to lookup how to include hidden SP 2010 fields in the LINQ to SharePoint Proxy.

Initial Hypothesis:  Use a Parameters.xml file to get SPMetal to generate the proxy with hidden fields.  You can use the IncludeHiddenColumns element within the ContentType element to include all hidden fields or as I have done in the resolution example, specify the fields to include using the element Column.

Resolution:
1.> Create a parameters.xml (name it for you specific project) and add it to the 14\bin directory.
2.> Use the dos cmd prompt to generate the LINQ to SharePoint Proxy.
3.> Add the generate LINQ to SharePoint proxy code to your Visual Studio project. 
4.> Add the query to show 1 of the hidden fields that is now part of your proxy.
The code above uses the default Microsoft.SharePoint.Linq.DataContext class to retrieve the data, it is easier to use your own DataContext class created when you build your LINQ to SharePoint proxy code.  Code below shows how to use the proxy generate data context.

More Info: You can use the same technique for custom site columns however, you will need to manually edit the proxy to perform the appropriate casting.  I would still use the iCustomMapping interface for custom site columns.

Wes Hacket gave me this tip - Using CKSDev you can create a new SPI template that generate the proxy.  With the proxy comes a parameter file, a custom code file and you can regenerate the proxy by right clicking on the proxy and running the SharEPoint Generator tool.  Screent shot to come!

SPMetal Code Generation Rules - http://msdn.microsoft.com/en-us/library/ee537010.aspx 

Tuesday 10 May 2011

SharePoint Designer Filter using Contains Operator

Problem:  I converted a List View web part that shows a document library into a Data View Web Part.  I tried to add a filter based on a query string.  The query string is only part of the field so I need to use a contains statement.

Resolution: The "Contains" operator is missing, by switching into code view I can use the contains operator in my xslt as shown below.

Data view xslt Tip: Retrieve a column named Kno and intermingle with xHtml

Monday 9 May 2011

iCustomMapping LinkFieldValue errors in Sandbox solutions

Problem:  I was trying to use the iCustomMapping interface to add additional columns of type LinkFieldValue to a sandox solution I am getting the error:
{"Type 'Microsoft.SharePoint.Publishing.Fields.LinkFieldValue' in Assembly 'Microsoft.SharePoint.Publishing, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' is not marked as serializable."}

Initial Hypothesis: I could not see why I as getting the error but a Google search found me a post that gave me the answer.

Resolution:  Change the code from
SPListItem item = (SPListItem)listItem;
this.ContentLinkField = item["LT1"];
To:
SPListItem item = (SPListItem)listItem;
string value = item.GetFormattedValue("LT1");
this.ContentLinkField = new LinkFieldValue(value);

More info:
http://www.alexbruett.net/?p=255 

Thursday 5 May 2011

WebControls not supported in sandbox solutions

Problem:  I wanted to use a SPGridView in a sandbox solution, so I added the code an intellesense doesn't pick it up.  Looked up the SPGridView class documentation on MSDN and it's not supported.  Not really sure why but hardly anything in the Microsoft.SharePoint.WebControls assembly works with sandbox solutions.

Initial Hypothesis:
Microsoft.SharePoint.WebPartPages.ListViewWebPart is another example of a control that can't be added progratically, however it can be added using SharePoint Designer.  I'm baffled!

File Upload Size Limits

Problem: Need to store files in excess of 2GB in SharePoint.
Initial Hypothesis:
  • 50MB is the default upload limit set by SharePoint OOTB.  You can change this on the farm as described here by Dave Coleman up to 2GB or 2047MB. 
  • A common misconception is that by using RBS and not you content database to store the blob you can overcome this 2GB limit.  We it's partly true...  The maximum file size for a file in SQL Server is 2GB however, the next restraint is SharePoint 2010 Server Object Model and this has a hard limit of 2GB for an upload so moving to RBS won't overcome the problem.
  • I believe SharePoint limit's the upload to 2GB due to IIS's worker process w3wp.exe, to upload a file you need to use all the IIS available memory to upload the full stream.  Each w3wp.exe worker process runs well with 2-4GB of memory, this is not a boundary just a good idea (on x64), therefore this makes sense to me that the SP2010 team have limited any file upload to 2GB.
  • Also be aware that increasing you upload file size to 2 GB has performance ramifications so it a user uploads a file and there is no memory available no new requests can be handled until the memory is available again.
Resolution:  Store large files outside SharePoint and surface them in SharePoint.  I believe there is another solution available using a Telerik Silverlight upload control but I haven't tried it.
More Info:
http://blah.winsmarts.com/2010-3-Large_File_Upload_in_SharePoint_2010.aspx

Update 24/07/2013: SharePoint 2013 has the same hard limit of 2 GB for the maximum upload size.  Technet states 50 MB is the default limit for SP2013, the default from an OOTB install is 250MB which is the same value you get with SharePoint Online/Office 365.