Monday, October 30, 2006

Error message "An item with the same key has already been added" after installing MOSS2007 Beta 2 Technical Refresh

When you get the error message when loading any from using Forms Services (custom created form or default workflows) "An item with the same key has already been added" the solution is quite simple.

Error: An item with the same key has already been added.

System.ArgumentException: An item with the same key has already been added.
at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
at System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value)
at Microsoft.Office.InfoPath.Server.SolutionLifetime. TokenizedNameTable..ctor(EnhancedBinaryReader reader)
at Microsoft.Office.InfoPath.Server.SolutionLifetime. Solution.<>c__DisplayClass8.b__7()
at Microsoft.Office.Server.Diagnostics. FirstChanceHandler.ExceptionFilter(Boolean fRethrowException, TryBlock tryBlock, FilterBlock filter, CatchBlock catchBlock, FinallyBlock finallyBlock)
at Microsoft.Office.Server.Diagnostics. ULS.SendWatsonOnExceptionTag(ULSTagID tagID, ULSCat categoryID, String output, Boolean fRethrowException, TryBlock tryBlock, CatchBlock catchBlock, FinallyBlock finallyBlock)
at Microsoft.Office.InfoPath.Server.SolutionLifetime. Solution.Deserialize(EnhancedBinaryReader reader, SolutionIdentity solutionIdForErrorsOnly)
at Microsoft.Office.InfoPath.Server.SolutionLifetime. Solution.ConstructFromSerializedStream(Stream stream, String assemblyRootFolder, SolutionIdentity solutionIdForErrorsOnly)
at Microsoft.Office.InfoPath.Server.SolutionLifetime. SolutionCache.<>c__DisplayClassb.b__7()
at Microsoft.Office.InfoPath.Server.SolutionLifetime. SolutionCache.EnsureObjectInCache[T](HttpContext context, SolutionIdentity solutionId, String cacheId, ValidateCacheObject`1 validateCacheObject, CreateCacheObject`1 createCachedObject, AddToCache`1 cacheObject)
at Microsoft.Office.InfoPath.Server.SolutionLifetime. SolutionCache.EnsureAdminSolutionInCache(HttpContext context, SolutionIdentity solutionId, FormTemplate formTemplate)
at Microsoft.Office.InfoPath.Server.SolutionLifetime. SolutionCache.GetAdminSolutionById(SPSite site, HttpContext context, SolutionIdentity solutionId, Solution solutionInCache, String cacheId)
at Microsoft.Office.InfoPath.Server.SolutionLifetime. SolutionCache.GetSolutionById(SPSite site, HttpContext context, SolutionIdentity solutionId)
at Microsoft.Office.InfoPath.Server. Controls.XmlFormView.DataBindInternal(SolutionMetaInformation solutionMetaInformation, DocumentMetaInformation documentMetaInformation, String absoluteSolutionLocation, Boolean hasCloseHandler, Document& document)
at Microsoft.Office.InfoPath.Server. Controls.XmlFormView.StartNewEditingSession()
at Microsoft.Office.InfoPath.Server. Controls.XmlFormView.EnsureDocument(EventLogStart eventLogStart)
at Microsoft.Office.InfoPath.Server. Controls.XmlFormView.<>c__DisplayClass3.b__1()
at Microsoft.Office.Server.Diagnostics. FirstChanceHandler.ExceptionFilter(Boolean fRethrowException, TryBlock tryBlock, FilterBlock filter, CatchBlock catchBlock, FinallyBlock finallyBlock)

In the event log it says

Source - Office Sharepoint Server
EventID - 5333
Category - Forms Services Conversion and Deployment 1:30:57PM

Detected converted data version mismatch. Solution Id:938c6d9d-5264-4ba3-8a20-8417e03d2cbf:ver:, expected version:4, saved version: 3. (User: MOSS\Admin, IP:, Request: http://MOSS/_layouts/CstWrkflIP.aspx?List={FAB78E36-0CAB-4B30-ADC5-248813312DF8})

Source - Office Sharepoint Server
EventID - 5368
Category - Forms Services Runtime 1:31:10PM

Exception occurred during request processing. (User: MOSS\Admin, Form Name: , IP:, Request: http://MOSS/_layouts/CstWrkflIP.aspx?List={FAB78E36-0CAB-4B30-ADC5-248813312DF8}, Form ID: , Type: ArgumentException, Exception Message: An item with the same key has already been added.)

Open an command prompt and run "stsadm -o reconvertallformtemplates".

Do not run from the Run option in the Start menu!

Thursday, October 26, 2006

Adding users from another forest using scripts (for audience compilation)

Like described earlier in post Audience Compilation In Multi Forest, it is not possible to use groups from a different forest in audience compilation.

As a workaround Microsoft suggested to create groups in the Sharepoint domain and add users (NOT GROUPS) from the other domain to this group. If you try to use DSMod to add the users from the other domain to the group (for example to add many users to a group), you will receive an error message: "The specified user does not exist".

This error is described in article KB892239 and is because DSMod also does not support multiple forests. The article gives a VBScript code example to work around this issue and add users via VBScript. That way adding users batch-wise is still possible.

Wednesday, October 04, 2006

Audience compilation in a multi forest environment

When you are trying to create an audience based on a membership of an Active Directory group and that group is located in a domain in another trust.......quit trying, it won't work. This can only be done with a workaround.

I have been in contact with Microsoft Support and they wrote me the following:

You have two Windows 2003 Active Directory Forests. Two Domains in these Forests are trusted (External Domain Trust, no Forest Trust). You have given some users from the External Domain permission to access SharePoint. This works so far. Now you want to create an Audience based on the membership of a Group in the External Domain.

You cannot compile this Audience. You receive the error:
One or more values typed on this page are not valid. Check the text for the indicated fields.

This is as Design Limitation of SharePoint. SharePoint cannot read across the own Active Directory Forest because of the technique used to access it.

The work around this Design Limitation follow these steps:
1. Create a Domain Local security group in the Domain where SharePoint resides 2. Add *users* from the External Domain domain to this group 3.
Create a Audience with a rule specifying the Domain Local group created in step 1 4. Compile the audience

So just create a local group in the Sharepoint Active Directory and add the users of the other domain to that group. Audience compilation then will work and users are added to the audience!!