Quick (annoying) thing. Whilst deploying a solution, you may see this error:
Error occurred in deployment step ‘Activate Features’: Key cannot be null. Parameter name: Key
This is unhelpfully connected to your Content Type definitions where you have FieldRefs and you’re closing them with the long tag, as opposed to the short tag, i.e.,
replace it with this to fix:
Thanks to Dhiraj.
A common method for creating Visual Studio-based SharePoint solutions is to actually create them in the SharePoint GUI first, and then save the site as a template, and import that .wsp file in to Visual Studio as a SharePoint project. This often saves a lot of the hard slog of starting from scratch in Visual Studio, but still giving you the reusability of Visual Studio based solution.
One small issue you may run in to though is the (re-)use of GUIDs in e.g., Site Columns. For safety, you may like to replace the GUIDs, but in the case where you have a lot to replace, doing this by hand could be cumbersome. Step up Visual Studio Macros. You can create a simple Macro to automate virtually any process. The only problem, in this case, though, is that my testing of macro-ing the Find/Replace was that I could easily find GUIDs in a file, but replacing them with a freshly generated one wasn’t obvious. So I created a custom macro.
Read more
If you’re using the handy Document Sets feature in SharePoint 2010 you may run in to a small issue where you make some changes to your document set (e.g., add/remove content types from the allowed contents). When you do this, and push changes down to existing document sets, you’ll see a little yellow bar appear on each document set with the message
“Content Types that are available to this Document Set have been added or removed. Click here to update the Document Set.”
The reason is that the document set refresh date needs updating. Quite why SharePoint can’t manage this for you, is beyond me, but nevertheless, if you do click the yellow bar, it disappears. But it still remains for all your other document sets. Irritating. So here’s how to remove the little yellow bar with the message using Powershell. The neatest way is just to provision the document set.
Read more
The Exchange Web Services Managed API is a great tool for exposing Exchange Web Services to a .NET programming environment. You are able to work with all the key features of an Exchange Mailbox, such as downloading messages. In my particular case, I’ve been capturing emails and storing them in a SharePoint document library.
The upload to SharePoint can be achieved by passing in a MemoryStream object - that is, you read an EmailMessage to memory, and then upload it to SharePoint. The FileAttachment object has a neat Load() method which allows you to read a FileAttachment to a MemoryStream:
Read more
I’ve been working with Kofax Express 2.0 recently to move documents from a scanner directly in to a SharePoint document library. I was using a custom list definition (created in Visual Studio) but was experiencing a strange error. If I created an instance of my list through the UI and then tried to scan from Kofax directly in to SharePoint, it was working no problem. However, if I tried to scan directly to SharePoint to the instance of the list created by the Visual Studio solution, I was getting the common error - “Object reference not set to an instance of an object”. There were no helpful logs on the Kofax or SharePoint end, and it was only through trial and error that I found the issue. I noticed that when the list was created through the UI, it was created with a URL of “/Document Library Name” whereas in my list instance definition in Visual Studio, I had given it a URL of “/Lists/Document Library Name”. It was the Lists part at the beginning which was causing an error. I don’t know why this caused Kofax to fail to find the library, but nevertheless, setting the URL in the list instance as just “/Document Library Name”, resolved the issue.
Read more
If you’ve encountered anything like this problem, then you may have had to update the permissions that a specific SQL login has. However, if the user you’re trying to edit is mapped to dbo, then you’re not allowed to make changes.
There are ways to do it, but you need a pretty thorough understanding of what you’re trying to achieve.
There’s a quick way around this using only the GUI. In SSMS, open the properties of the database(s) you need access to. In the ‘Files’ page, you’ll see the Owner of the database. This is quite likely the account you want to add additional permissions to. But since it’s mapped to dbo, you can’t. Therefore you update the owner of the database to something other than your login (e.g., sa). When you do this, you should then be able to add the required permissions to your login.
Read more
Painted lady butterfly timelapse showing a butterfly turning out of its chrysalis.
First experimentation with timelapse stuff. This was a crummy old webcam attached to my computer.
Apparently YouTube took offence at my choice of copyrighted music. Bastards.
You may encounter a random error when using a custom Visual Studio SharePoint 2010 workflow. Everything appears OK, but when you go to edit the item that the workflow is running on, the EditForm fails to load and you see an error like:
`Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentNullException: Value cannot be null.
Parameter name: s
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[ArgumentNullException: Value cannot be null.
Parameter name: s]
System.IO.StringReader..ctor(String s) +10151478
System.Xml.XmlDocument.LoadXml(String xml) +51
Microsoft.SharePoint.Publishing.Internal.WorkflowUtilities.FlattenXmlToHashtable(String strXml) +90
...
`
Tip: Error occurred in deployment step Activate Features: Object not set to an instance of an object
Yet another SharePoint vagary. If you’re trying to deploy a feature and get the unhelpful error: “Error occurred in deployment step ‘Activate Features’: Object not set to an instance of an object” check the scope of the feature that you’re trying to deploy. I added a new feature to a project that had another working feature. Both were calling the Microsoft.Office.Workflow.Feature assembly but only one was failing and it was only after a lot of messing about that it turned out to be this innocuous little setting.
Read more
Quick tip: this plagued me for a while. You may develop a custom workflow which should only be associated with particular content types. You can deploy it to your site and then manually associate it to your content type. It’s possible to do this in code but the process isn’t as straight forward as it should be. Not to mention the fact that it’s infuriatingly hard to debug EventReceivers (“no symbols have been loaded” misery!).
Read more