Save attachments in repeating tables, and save them to folders - InfoPath Dev Sign in | Join | Help in Qdabra qRules Qdabra Software Product Support (Entire Site) InfoPath Dev InfoPath Dev is dedicated to bringing you the information and tools you need to be successful in your Microsoft Office InfoPath development projects. Home Blogs Forums Photos Downloads InfoPath Dev » Qdabra Software Product Support » Qdabra qRules » Save attachments in repeating tables, and save them to folders Save attachments in repeating tables, and save them to folders Last post 04-13-2016 10:26 AM by Laurie Wheeler. 17 replies. Page 1 of 2 (18 items) 1 2 Next > Sort Posts: Oldest to newest Newest to oldest Previous Next 04-11-2016 10:30 AM Laurie Wheeler Joined on 09-11-2007 Ohio Posts 47 Save attachments in repeating tables, and save them to folders Reply Contact I have a repeating table that contains a file attachments, and I need to save these attachments into a folder. The folder name will match the InfoPath filename (which is unique). Are there detailed instructions somewhere. We are evaluating qRules V7.2 to purchase. I was able to get a form to submit a single file attachment to upload to a designated library. I cannot seen to locate step by step instructions for the next step - doing this on a repeating file attachment and then creating a folders and sub folders for these attachments. Here is my submit to sharepoint (actual URL renamed) command: SaveToSharePoint /url=http://website/subsite/documentLibrary /xpath=/my:myFields/my:File /dsnamews=CopyIntoItems I have a very complex large infopath form. It is a SP2013, browser form. Form-uniquename stored in 'libraryA' Attachments stored in 'library B', folder "Form-uniquename", 'files name=qRulesFilename' Any help or pointers are much appreciated. Laurie Wheeler Filed under: #save attachments to folders, #qRules, #mutliple attachments 04-11-2016 10:43 AM In reply to Hilary Stoupa Joined on 06-20-2008 Posts 13,297 Re: Save attachments in repeating tables, and save them to folders Mark as Not AnswerMark as Answer... Reply Contact I'm not sure if we have a step by step any place on this exact scenario. First, if your attachment field is in a repeating group, or the field itself is repeating, qRules will save all the files when the command executes. Are you trying to save all files to the same folder? In that case, you'd use CreateSharePointFolder to create the folder, then you could use a concat formula for your SaveToSharePoint command to modify the URL to include the folder. Does that make sense? Have you tried the command yet with a repeating attachment? Also, if you have multiple attachment fields, you'll find info in the User Guide that installs with qRules on using a reference to add the two necessary attributes to more than one attachment field. Hilary Stoupa 04-11-2016 12:58 PM In reply to Laurie Wheeler Joined on 09-11-2007 Ohio Posts 47 Re: Save attachments in repeating tables, and save them to folders Mark as Not AnswerMark as Answer... Reply Contact I was able to get all files to submit to a SharePoint library now. My issue was how I was creating the repeating file attachment. I have files that get attached in a repeating table (1 file per row of the table) and many files that get attached into a separate repeating table (multiple files per each row of the table) I have two buttons, one for table for that file attachment control set. Now I need to be able to ‘link’ the attached files back to the form from within the attachment library. (Reverse lookup so to speak) The easiest way I can think to do this is to have additional column metadata submitted with the files that include the form name (or its url), and the view name or some other ‘static’ information. So, that users can look at the files library and know which form the file and view the form bellows to. If simple metadata is not possible with qRules, then I would need to know how to have a folder for each form created, and subfolders within for each ‘view’ where these files are attached. This isn't an ideal situation, use of folders is discourage in Sharepoint within our organization. The YouTube video is not very clear as to how to handle the iteration through the multiple file attachments. Laurie Wheeler 04-12-2016 06:47 AM In reply to Laurie Wheeler Joined on 09-11-2007 Ohio Posts 47 Re: Save attachments in repeating tables, and save them to folders Mark as Not AnswerMark as Answer... Reply Contact I'm trying to create the rules that will create the folder and upload the files into the folder, and my commands is returning an error:Action: SaveToSharePoint. Arguments: url: http://nacertspfe01.stoneridge.com/CDCM6/CMDoc2/CM-2016-04-12T09_43_23 xpath: /my:myFields/my:Files dsnamews: CopyIntoItems . Details: <nativehr>0x80070003</nativehr><nativestack></nativestack>There is no file with URL 'http://nacertspfe01.stoneridge.com/CDCM6/CMDoc2/CM-2016-04-12T09_43_23/2016041209433713828_927-415-01-C OBS.pdf' in this Web.. Stack: Server stack trace: at Microsoft.SharePoint.SPFile.SaveBinaryInternal(Stream file, Int64 fileSizeToSave, SPFileStreamManager spmgr, Boolean isBackgroundSave, String checkInComment, Boolean checkRequiredFields, Boolean autoCheckoutOnInvalidData, Boolean bIsMigrate, Boolean bIsPublish, Boolean bForceCreateVersion, String lockIdMatch, SPUser modifiedBy, DateTime timeLastModified, Object varProperties, SPFileFragmentPartition partitionToCheck, SPFileFragmentId fragmentIdToCheck, SPFileFragmentPartition[] fragPartitionsToDelete, String csvPartsToDelete, Stream formatMetadata, String etagToMatch, Boolean bSyncUpdate, SPLockType lockType, String lockId, TimeSpan lockTimeout, Boolean refreshLock, Boolean requireWebFilePermissions, Boolean failIfRequiredCheckout, Boolean validateReqFields, Guid newDocId, Boolean bypassMaxFileCheck, Boolean bypassQuotaCheck, Boolean bypassVirusScan, SPVirusCheckStatus newVirusStatus, Int32 newVirusVendorId, String newVirusInfo, Byte[] newVirusInfoEx, Boolean bUseTimeLastModified, SPVirusCheckStatus& virusCheckStatus, String& virusCheckMessage, String& etagReturn, Boolean& ignoredRequiredProps, SPFileInfo& fileProps) at Microsoft.SharePoint.SPFile.SaveBinary(Stream file, SPFileSaveBinaryParameters parameters) at Microsoft.SharePoint.SPFile.SaveBinary(Stream file, Boolean checkRequiredFields, Boolean createVersion, String etagMatch, String lockIdMatch, Stream fileFormatMetaInfo, Boolean requireWebFilePermissions, String& etagNew) at Microsoft.SharePoint.SPFile.SaveBinary(Byte[] file) at Microsoft.SharePoint.SPFile_SubsetProxy.SaveBinary__Inner(Byte[] file) at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs) at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg) Exception rethrown at [0]: at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) at Microsoft.SharePoint.SPFile_SubsetProxy.SaveBinary(Byte[] file) at Microsoft.SharePoint.SPFile.SaveBinary__Inner(Byte[] file) at Microsoft.SharePoint.SPFile.SaveBinary(Byte[] file) at Qdabra.Tools.RulesLibrary.Commands.SaveFileToSharepoint_Browser(String& base64Value, String& fileUrl, XPathNavigator fileNode, String requestedFileName, String fileNameXPath, String overwriteExisting, Boolean preserveName) at Qdabra.Tools.RulesLibrary.Commands.SaveToSharePoint_Browser(String url, String domName, String nodeXPath, String fileName, String fileNameXPath, String overwriteExisting, String copyServiceName, String copyServiceUrl, Boolean clear, Boolean preserveName) at Qdabra.Tools.RulesLibrary.Commands.SaveToSharePoint() at Qdabra.Tools.RulesLibrary.Commands.RunCommand(String commandName) at Qdabra.Tools.RulesLibrary.Commands.ExecuteCommand()Here is my command in the rule to upload the file attachments. This is a repeating table. the Rule does not have any conditions associated. the rule before creates the folder, which by the error, the URL would be correct, but the folder isn't getting created. concat("SaveToSharePoint /url=", SharePointSiteUrl(), url, " /xpath=/my:myFields/my:Files", " /dsnamews=CopyIntoItems") I would upload the form, but there is no mechanism for me to upload it into this posting. Laurie Wheeler 04-12-2016 07:36 AM In reply to Hilary Stoupa Joined on 06-20-2008 Posts 13,297 Re: Save attachments in repeating tables, and save them to folders Mark as Not AnswerMark as Answer... Reply Contact You can attach a file under the options tab in a reply. Is this a browser or a filler form? You probably don't need the dsnamews parameter. Have you tried just creating the folder to see if there is any error on that command? Hilary Stoupa 04-12-2016 07:46 AM In reply to Laurie Wheeler Joined on 09-11-2007 Ohio Posts 47 Re: Save attachments in repeating tables, and save them to folders qRulesFolders.xsn Mark as Not AnswerMark as Answer... Reply Contact This is just a test form to workout the logic. It is a SP2013 IPFS browser form sandboxed. It will not be deployed through central admin. Laurie Wheeler 04-12-2016 07:52 AM In reply to Hilary Stoupa Joined on 06-20-2008 Posts 13,297 Re: Save attachments in repeating tables, and save them to folders Mark as Not AnswerMark as Answer... Reply Contact I would still test w/out the dsnamews parameter. You'll have to set it to full trust when you preview it, but can set it back to domain when you publish to sandbox. Have you tested just the create folder command? Hilary Stoupa 04-12-2016 08:27 AM In reply to Laurie Wheeler Joined on 09-11-2007 Ohio Posts 47 Re: Save attachments in repeating tables, and save them to folders qRulesFolders.xsn Mark as Not AnswerMark as Answer... Reply Contact I added another button to test just the 'create folder' and it doesn't seem to be functioning, new version attached. No error is returned to qRules, the dataconnectons dataFields result does return 'servererror' but nothing more than that. Both the form library and the destination documents library have contribute for all users so it shouldn't be a permission issue. Since SharePoint isn't throwing up a guid to track down in the logs, I'm not sure where to go next. Laurie Wheeler 04-12-2016 08:38 AM In reply to Hilary Stoupa Joined on 06-20-2008 Posts 13,297 Re: Save attachments in repeating tables, and save them to folders Mark as Not AnswerMark as Answer... Reply Contact Have you tried using the qRules command for creating a folder, instead of just the web service directly? CreateSharePointFolder - it is in the command overview. Hilary Stoupa 04-12-2016 09:21 AM In reply to Laurie Wheeler Joined on 09-11-2007 Ohio Posts 47 Re: Save attachments in repeating tables, and save them to folders Mark as Not AnswerMark as Answer... Reply Contact I am unclear on the /name parameter for this command. is this just the 'path' to where the folder is to be created, or is it to include the actual new folder name to create as well.Yes! This command created a folder called 'test' in my designated library. CreateSharePointFolder /name=test /siteurl=http://nacertspfe01.stoneridge.com/CDCM6 /library=CMDocs2I need to have the name parameter pull in the forms formName I tried this concat but I don't think it is correct. Does each parameter need to be separated?concat("CreateSharePointFolder /siteurl=http://nacertspfe01.stoneridge.com/CDCM6 /library=CMDocs2 /name=", formName) Laurie Wheeler 04-12-2016 09:27 AM In reply to Hilary Stoupa Joined on 06-20-2008 Posts 13,297 Re: Save attachments in repeating tables, and save them to folders Mark as Not AnswerMark as Answer... Reply Contact Are you getting an error with that formula? What is the value of the "formName" field? Hilary Stoupa 04-12-2016 09:41 AM In reply to Laurie Wheeler Joined on 09-11-2007 Ohio Posts 47 Re: Save attachments in repeating tables, and save them to folders qRulesFolders.xsn Mark as Not AnswerMark as Answer... Reply Contact No errors, just doesn't create it. formName is generated when a new file is opened, the initial rule is set under the Form Load rules, if formName is blank set to concat("CM-",now()). The formName field has a default value of translate(., ' ~#%&*{}<>:?\/|"+.[]…', "____________________") so that the invalid characters get translated into underscores.The first rule on the TestOnly (Create folder) button is disabled, this one will create a folder named 'test'. Its the Rule(dynamic foldername) I'm trying to get worked out. Do you think the 'translate' function putting a wrench in the works? Laurie Wheeler 04-12-2016 10:26 AM In reply to Laurie Wheeler Joined on 09-11-2007 Ohio Posts 47 Re: Save attachments in repeating tables, and save them to folders Mark as Not AnswerMark as Answer... Reply Contact One step closer Hilary! I added the rule to create the folder when the form loads at the same time the formName is created. I might work for us because we will need the folder existing before documents are added to the InfoPath form. Laurie Wheeler 04-12-2016 10:47 AM In reply to Hilary Stoupa Joined on 06-20-2008 Posts 13,297 Re: Save attachments in repeating tables, and save them to folders Mark as Not AnswerMark as Answer... Reply Contact One thing that will help you is if you put the QdabraRules ExecutionHistory repeating History group on your form while doing your initial development work. Then you can see the results of these concat formulas. I would not use that default in the form name field - instead, in the rule where you set the field, translate the now() function to remove unwanted chars. Hilary Stoupa 04-13-2016 05:12 AM In reply to Laurie Wheeler Joined on 09-11-2007 Ohio Posts 47 Re: Save attachments in repeating tables, and save them to folders Mark as Not AnswerMark as Answer... Reply Contact Thank you -I will certainly incorporate both of those things. Laurie Wheeler Page 1 of 2 (18 items) 1 2 Next > Copyright © 2003-2019 Qdabra Software. All rights reserved.View our Terms of Use.
I'm trying to create the rules that will create the folder and upload the files into the folder, and my commands is returning an error:
Action: SaveToSharePoint. Arguments: url: http://nacertspfe01.stoneridge.com/CDCM6/CMDoc2/CM-2016-04-12T09_43_23 xpath: /my:myFields/my:Files dsnamews: CopyIntoItems . Details: <nativehr>0x80070003</nativehr><nativestack></nativestack>There is no file with URL 'http://nacertspfe01.stoneridge.com/CDCM6/CMDoc2/CM-2016-04-12T09_43_23/2016041209433713828_927-415-01-C OBS.pdf' in this Web.. Stack: Server stack trace: at Microsoft.SharePoint.SPFile.SaveBinaryInternal(Stream file, Int64 fileSizeToSave, SPFileStreamManager spmgr, Boolean isBackgroundSave, String checkInComment, Boolean checkRequiredFields, Boolean autoCheckoutOnInvalidData, Boolean bIsMigrate, Boolean bIsPublish, Boolean bForceCreateVersion, String lockIdMatch, SPUser modifiedBy, DateTime timeLastModified, Object varProperties, SPFileFragmentPartition partitionToCheck, SPFileFragmentId fragmentIdToCheck, SPFileFragmentPartition[] fragPartitionsToDelete, String csvPartsToDelete, Stream formatMetadata, String etagToMatch, Boolean bSyncUpdate, SPLockType lockType, String lockId, TimeSpan lockTimeout, Boolean refreshLock, Boolean requireWebFilePermissions, Boolean failIfRequiredCheckout, Boolean validateReqFields, Guid newDocId, Boolean bypassMaxFileCheck, Boolean bypassQuotaCheck, Boolean bypassVirusScan, SPVirusCheckStatus newVirusStatus, Int32 newVirusVendorId, String newVirusInfo, Byte[] newVirusInfoEx, Boolean bUseTimeLastModified, SPVirusCheckStatus& virusCheckStatus, String& virusCheckMessage, String& etagReturn, Boolean& ignoredRequiredProps, SPFileInfo& fileProps) at Microsoft.SharePoint.SPFile.SaveBinary(Stream file, SPFileSaveBinaryParameters parameters) at Microsoft.SharePoint.SPFile.SaveBinary(Stream file, Boolean checkRequiredFields, Boolean createVersion, String etagMatch, String lockIdMatch, Stream fileFormatMetaInfo, Boolean requireWebFilePermissions, String& etagNew) at Microsoft.SharePoint.SPFile.SaveBinary(Byte[] file) at Microsoft.SharePoint.SPFile_SubsetProxy.SaveBinary__Inner(Byte[] file) at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs) at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg) Exception rethrown at [0]: at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) at Microsoft.SharePoint.SPFile_SubsetProxy.SaveBinary(Byte[] file) at Microsoft.SharePoint.SPFile.SaveBinary__Inner(Byte[] file) at Microsoft.SharePoint.SPFile.SaveBinary(Byte[] file) at Qdabra.Tools.RulesLibrary.Commands.SaveFileToSharepoint_Browser(String& base64Value, String& fileUrl, XPathNavigator fileNode, String requestedFileName, String fileNameXPath, String overwriteExisting, Boolean preserveName) at Qdabra.Tools.RulesLibrary.Commands.SaveToSharePoint_Browser(String url, String domName, String nodeXPath, String fileName, String fileNameXPath, String overwriteExisting, String copyServiceName, String copyServiceUrl, Boolean clear, Boolean preserveName) at Qdabra.Tools.RulesLibrary.Commands.SaveToSharePoint() at Qdabra.Tools.RulesLibrary.Commands.RunCommand(String commandName) at Qdabra.Tools.RulesLibrary.Commands.ExecuteCommand()
Here is my command in the rule to upload the file attachments. This is a repeating table. the Rule does not have any conditions associated. the rule before creates the folder, which by the error, the URL would be correct, but the folder isn't getting created.
concat("SaveToSharePoint /url=", SharePointSiteUrl(), url, " /xpath=/my:myFields/my:Files", " /dsnamews=CopyIntoItems")
I would upload the form, but there is no mechanism for me to upload it into this posting.
This is just a test form to workout the logic. It is a SP2013 IPFS browser form sandboxed. It will not be deployed through central admin.
I added another button to test just the 'create folder' and it doesn't seem to be functioning, new version attached. No error is returned to qRules, the dataconnectons dataFields result does return 'servererror' but nothing more than that. Both the form library and the destination documents library have contribute for all users so it shouldn't be a permission issue. Since SharePoint isn't throwing up a guid to track down in the logs, I'm not sure where to go next.
I am unclear on the /name parameter for this command. is this just the 'path' to where the folder is to be created, or is it to include the actual new folder name to create as well.
Yes!
This command created a folder called 'test' in my designated library. CreateSharePointFolder /name=test /siteurl=http://nacertspfe01.stoneridge.com/CDCM6 /library=CMDocs2
I need to have the name parameter pull in the forms formName I tried this concat but I don't think it is correct. Does each parameter need to be separated?
concat("CreateSharePointFolder /siteurl=http://nacertspfe01.stoneridge.com/CDCM6 /library=CMDocs2 /name=", formName)
No errors, just doesn't create it.
formName is generated when a new file is opened, the initial rule is set under the Form Load rules, if formName is blank set to concat("CM-",now()). The formName field has a default value of translate(., ' ~#%&*{}<>:?\/|"+.[]…', "____________________") so that the invalid characters get translated into underscores.The first rule on the TestOnly (Create folder) button is disabled, this one will create a folder named 'test'. Its the Rule(dynamic foldername) I'm trying to get worked out. Do you think the 'translate' function putting a wrench in the works?
One step closer Hilary!
I added the rule to create the folder when the form loads at the same time the formName is created.
I might work for us because we will need the folder existing before documents are added to the InfoPath form.
Thank you -I will certainly incorporate both of those things.