cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
DannyB72
Frequent Visitor

"Move folder" with documentsets from one folder to another

I've created a flow who is triggered everytime an item in the library is created or edited. The flow calculate different values und updates "hidden" fields from the current item if this item is a specific contenttype (files or documentsets). He also move the documentsets depending on certain values in fields from one folder to another folder in the same library and changes the contenttype of the moved item to another one.


On creating the first documentset with contenttype "BV Banf" in library-folder "01_BV_Banf", the flow triggers and updates certain fields, everything works great. By choosing in a menufield the option "Banf einreichen" in the "BV Banf"-documentset and saving it, the flow triggers again, checks the settings, calculate certain fields, update some fields, change the conttenttype of the docuemntset to "BV Erstellung" and moves the documentset with "Move Folder"-action to the folder "02_BV_Erstellung" in the same library. This works also.

Same procedure: on the same documentset (contenttype "BV Erstellung"), setting the menu-field to another value and saving this, the flow triggers again and now the contenttype is changed to "BV Freigabe", values are updated and the "Move Folder"-action is prepared to move the documentset to the folder "03_BV_Freigabe". But now, the "move folder" action fail with an error message:

An item with the same key has already been added. CallStack -- at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
at Microsoft.SharePoint.Deployment.MetaInfoHandler.Add(MetaInfoProperty property)
at Microsoft.SharePoint.Deployment.FolderSerializer.GetMetaInfo(Object metaInfoObject, SPWeb parentWeb, SerializationInfo info, ExportObjectManager objectManager, Guid listID, Guid itemID, String folderETag)
at Microsoft.SharePoint.Deployment.FolderSerializer.GetDataFromDataSet(Object obj, SerializationInfo info, StreamingContext context)
at Microsoft.SharePoint.Deployment.DeploymentSerializationSurrogate.GetObjectData(Object obj, SerializationInfo info, StreamingContext context)
at Microsoft.SharePoint.Deployment.XmlFormatter.SerializeObject(Object obj, ISerializationSurrogate surrogate, String elementName, Boolean bNeedEnvelope)
at Microsoft.SharePoint.Deployment.XmlFormatter.Serialize(Stream serializationStream, Object topLevelObject)
at Microsoft.SharePoint.Deployment.SPExport.SerializeObjects()
at Microsoft.SharePoint.Deployment.SPExport.Run()
clientRequestId: 56aef7ea-7334-4868-a92c-df7fd0017aad
serviceRequestId: 56aef7ea-7334-4868-a92c-df7fd0017aad

Destination folder for the "move folder"-action are passed by variable and the variables are filled conditionaly with the exact names of the destination folders . The destination folder is empty and there are nor special userrights-restriction on the folder.

Changing the contenttype of documentsets is necessary because with every change of contenttype, there are some new fields to edit.

I don't understand, why the flow moves correctly the documentset of contenttype "BV BANF" to folder "01_BV_Banf" and failes when moving the documentset of contenttype "BV Erstellung" from "01_BV_BANF" to "02_BV_Erstellung". I also don't understand the error message...

FlowMoveFolder.PNG
The expression is: concat('/Bestellwesen/', variables('MoveToFolder'))
Variable "MoveToFolder" contains the name of destination folder "01_BV_BANF" or "03_BV_Freigabe"...
The "Identifier" ("Zu verschiebender Ordner") here cames from the first "trigger"-action of the flow.

 

So, for sumary:

  • i create a documentset (contenttype BV_Banf) - the flow triggers, calculate some fields and update this fields, then terminate > Ok
  • i change  a menu-field and save the documentset - the flow triggers, calculate some fields and update this, fields, change the contenttype of documentset and move the documentset to a subfolder, then terminate > Ok
  • I change a second time on the same documentset the menu-field with another option -  the flow triggers again, calculate some fields and update this, fields, change the contenttype of documentset and try to move the documentset to another subfolder but stop with the described error-mmessage > Error-Message


Thank you for any advice or help...
Danny

1 REPLY 1
DannyB72
Frequent Visitor

Re: "Move folder" with documentsets from one folder to another

Not sure, why the error has disappeared...

On the library, there were several columns with property "required". This columns has been hidden for several contenttypes in the library - files with this contenttypes has been marked as "to inspect" by sharepoint in the library in in the documentsets. I've disabled the "required"-property for all this columns in the library.

Suddenly, on testing the flow again, the errormessage has disappeared... Why? I don't know... Perhaps the change of the "required"-property? Perhaps a bugfix on Microsoft's SharePoint? 

 

Greets,

Danny

 

Helpful resources

Announcements
firstImage

New Ranks and Rank Icons released on April 21!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Automate Community!

firstImage

Now Live: Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Community Summit North America

The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Users online (4,897)