Exchange is built on web services and as I posted about a while about accessing EWS from SharePoint can be pretty neat. There is a managed API to make your life even easier. However, one issue you may come across is actually getting SharePoint and Exchange to talk nicely to each other. This will walk you through some of the steps required to get things going.
Posts Tagged ‘linkedin’
SharePoint workflow + list item edit + value cannot be null
Thursday, May 26th, 2011You 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:
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
…
SharePoint + Visual Studio + Get Current User
Wednesday, May 4th, 2011A frequently asked question in the MSDN forums is “how you can get access to the user who is interacting with your workflow?”. For example, the user modifying a task. The workflow is likely running in a different context and/or session to your browser session so there’s not an obvious tie-up.
However, in this scenario, you can get the login name of the person who modified the SharePoint task, via the Executor property of the OnTaskChanged event. Simply bind the Executor property to a string (e.g., “taskLastModifiedBy”) and whenever the task changes, SharePoint will copy the user ID to this property in the format of DOMAIN\\LoginName. You can then get an SPUser object for that login name with, e.g.
Note: On a related subject, and the thing that prompted this post – if you’re trying to update a Person or Group field on your workflowProperties.Item, then you must pass it an SPUser object! This is bizarre, because other types of list (e.g, the task list) you can pass it a string and SharePoint will do the rest. I spent ages and all kinds of different things and always getting the “Invalid data has been used to update the list item. The field you are trying to update may be read only.” error. Annoying.
Could not load web.config file. The given key was not present in the dictionary.
Friday, March 25th, 2011Quick hint about debugging SharePoint projects in Visual Studio 2010. You may find a bizarre error where deploying projects/solutions is fine, but trying to debug doesn’t work. You see an error alert with the text:
“Could not load the Web.config configuration file. Check the file for any malformed XML elements, and try again. The following error occurred: The given key was not present in the dictionary.”
Checking the Web.config shows no malformed XML at all. One thing to check into is the configuration of alternate access mappings in Central Administration. For debugging to work, the Site URL property of your SharePoint project must match the URL of the Default zone for your web application.
Check: Central Administration > Application Management > Configure alternate access mappings > Edit public URLs
new SPSite – FileNotFoundException
Wednesday, February 2nd, 2011It seems to me that every SharePoint developer, at some point in their career, will encounter this particular error. It’s one of those infuriatingly obtuse errors that could be caused by a multitude of different issues – either individually or cumulatively. In my case, I was in the middle of developing a SharePoint timer job and I had a particular piece of code that I wasn’t too sure about, and so wanted to test very quickly, over and over again – without the rigmarole of deploying/retracting solutions, hunting through Central Admin to run the job, etc. I just wanted to run this particular section of code against the SharePoint object model and see what happened. As is a common technique for this, I started up a fresh Console Application project, pasted in my code and figured that would be enough.
I was quite wrong and have spent the best part of the last 3 hours just trying to get the console app working. Since it was a standard C# console application, I added a reference to Microsoft.Sharepoint (14.0) and a using statement for the same assembly. The start of my code was the generic way just to get “in” to my SharePoint instance:
using (SPSite siteCollection = new SPSite(“http://sharepoint/”)) {
but when I then started debugging, it fell over on that line, with the “FileNotFoundException”. The web application and a site collection at that address definitely existed. Deploying a SharePoint solution in the usual way, worked. Running as the identity of the application pool, worked. So the key problem was in my own “Dev” account that I use to log in to the Dev machine.
So, it was off to Google for some advice. I won’t rehash everything I went through to get it working, but if you’re suffering from a similar issue, then you could start looking in any of these areas.
- Is your devenv running as Administrator?
- Does the process that your devenv/vshosts are running under have sufficient privilege to the Sharepoint farm? (Consider Site Collection admin, and possibly Farm Admin)
- Does the user account have required privileges to the actual databases on the SQL Server?
- Minimum of read/write on all content databases (common practice to give db_owner)
- Read/write/db_owner main Config database and Administration Content database
- WSS_CONTENT_APPLICATION_POOLS role on Config and Admin databases
- Is your code compiled in 32-bit mode when you’re running on a 64-bit machine?
As it stands, I can’t be certain which of these “solutions” fixed the problem due to the fact that I tried them in various orders and did or didn’t restart various services/devenv/etc. throughout. But a combination of the above sorted me out – hopefully it can help you too. If there are any other common causes/solutions to this issue, feel free to leave them in the comments.
Some helpful links (check especially the comments in some of these):
- FileNotFound Exception with Sharepoint 2010 with the SPSite Constructor
- System.IO.FileNotFoundException when creating SPSite objects using the SharePoint object model
- Solution: System.IO.FileNotFoundException on “SPSite = new SPSite(url)”
- The following might be helpful if you find that the assortment of logins in your SQL Server are a mess, and dbo is mapped to your login for the Content/Admin databases and you need to reassign that, in order to grant WSS_CONTENT role: SQL Server 2005: Map dbo to new Login
- This might be a more robust way of achieving the above: INF: SQL Server Procedure to Change Object Owner



for