Auto Generate Unique Name for Document Library Issue - InfoPath Dev
in

InfoPath Dev

Auto Generate Unique Name for Document Library Issue

Last post 02-17-2013 12:57 PM by Bnighgrow. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 02-13-2013 12:51 PM

    Auto Generate Unique Name for Document Library Issue

    Hello,

    I am having an issue with the very popular method of generating the unique name to use for the Form Libraries, that method being max(ID) + 1. Lately I have been using this method in all my forms in order to provide a nice way of keeping the names unique after each submission. However I also been working on the best way to manage security within my Form Libraries. So as most people know in order for a user to submit to a Doc Library they need "add item" permission, but along with that you get "View Item" as well. What I was trying to accomplish was a way for a user to submit an item and then be stripped of permissions on that item, so that if they ever navigated to the URL of the Library they wouldn't see any items...

    That had led me to a few write-ups on using the Impersonation step in SharePoint Designer. So I was using SPD Workflow so that after an item has been submitted, remove the permissions for the group so no one can see the items. Well worked pretty well at first glimpse, but as soon as a user goes to submit another form... BAM! Gets hit with an access denied 5567 error. Well long story short it took me a while to realize why this was happening, and it was because on the Data Connection/Retrieve "ID" (for the unique name) the user didn't have permission's on any of the items after they had submitted so they could not retrieve the max ID...

    So my question is that is there any other alternatives to managing a Unique Name for each submission?

    Thanks,

    Brandon

  • 02-17-2013 12:41 PM In reply to

    Re: Auto Generate Unique Name for Document Library Issue

    Hi Brandon,

    That "very popular method" is no good because SharePoint doesn't lock the count so if you have multiple people writing simultaneously, you could have contention and the Max(ID)+1 will return a value that is truly no longer available.

    The correct technique is to submit with a unique ID in the form that is promoted. Then, right after you submit, you query the library filtering for the item with the unique ID. You then copy the ShP list or library ID into the form from the secondary data source and resubmit.  That will guarantee that two people submitting simultaneously don't cause problems with your form numbers.

    To remove permissions, the best way is to use the Impersonation step that you have discovered. You need to make sure you remove the permissions for just the item that got submitted, not for the entire library. That's probably the issue. Just make sure you remove permissions only on the current item and you should be ok.

    If not, send me email and we'll demo the technique to you.

    Note: ShP 2010 has a 5000 ACL limit around libraries so if you are going to store more than 5000 forms in the library, you'll need another option. I recommend looking at our DBXL Web Service which will scale to millions and handles dynamic document level permissioning based on data within your form (i.e. no workflow needed).

    Patrick Halstead
    Project Manager at Qdabra
  • 02-17-2013 12:57 PM In reply to

    Re: Auto Generate Unique Name for Document Library Issue

    Thank you for the reply. I went ahead and decided to do the concat(Username - now()) for the time being. This way I don't have to have that data connection to retrieve the ID. Also I did get the impersonation working but since I am removing the permissions from each of the items. So when the user opened the form and the data connection goes to retrieve the ID, they would get the access denied. Thank you though. Brandon
Page 1 of 1 (3 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.