Posts

Showing posts from June, 2013

ProcessBatchData Helper Class

There are a few ways to add multiple rows to a SharePoint list. The iterative approach (i.e.: line by line) is simple, but this pattern will fail a CAF report. The better way to get the data up is loading a batch file using the ProcessBatchData method on your trusty SPWeb object. (The official blurb on the method is  here .) The problem with this is that is requires a well formatted XML string. The easiest way to accomplish this is to writer a helper class and it is quite a life saver. Here is the class, followed by a sample of how to use the code.    public class ProcessBatchDataHelper     {         private const string ProcessBatchStartXml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";         private const string ProcessBatchRowsStartXml = "<ows:Batch OnError=\"Continue\">";         private const string ProcessBatchEndXml = @"</ows:Batch>";     ...

Token Replacement in Visual Studio

I was working on a simple WCF service, including a generic handler (.ashx). My code looked good until I tried to access the url - it started complaining that it did not know what ' $SharePoint.Project.AssemblyFullName$ ' was. A little digging ( here  and here  ) revealed at VS will not replace its tokens in all file types - you may need to specify them in the project file. Generic handlers are one of those types. So, first I unloaded the project and added the following to the property group: <PropertyGroup>  <TokenReplacementFileExtensions> ashx </TokenReplacementFileExtensions> </PropertyGroup> I then reloaded the project and redeployed. Too easy.

Create a new SharePoint Farm: Local accounts should only be used in stand alone mode

I was creating my new VM and installed a SharePoint Farm on the local machine. Easy enough. All was good until I tried to run the configuration wizard. That is when it all when wrong. I got the fantastic error message: Local accounts should only be used in stand alone mode Some simple searching brought my to this post ( here  ) that gave me the solution. Basically, you need to run the installation in PowerShell (using New-SPConfigutionDatabase ), as it exposes properties that are not available through the wizard. Once the database has been created, SharePoint thinks it has a Farm and the configuration wizard can continue on its merry way. Its pretty simple when you know how ....

SharePoint 2010 Code Samples

I have come across the following code samples for SP 2010 development on the Microsoft site. It is full of helpful code snippets and solutions that will probably save me a lot of searching. The samples are  here