Get Document ID based on specific folder in SharePoint 2013 document library

Hi,
I have created document library with multiple folders in SharePoint 2013.I have created workflow to assign file name convention like this "attachment name-ID".When i created document in one folder the ID is 1 and when I created document in another
folder, the Id is 2.
But my requirement is to create Id based on the folder means if document is not there in the folder then the document id should start from 1 and Id should ends within that folder and in another folder it should start from 1 again
Any help?
Thank you.

In this case you will have to build a custom document id provider, see here:
http://www.sharepointeurope.com/blog/2013/11/21/how-to-create-a-custom-document-id-provider-with-sharepoint-2013
Here's code taken from that post that shows the minimal implementation of such a provider:
using System.IO;
using Microsoft.Office.DocumentManagement;
using Microsoft.SharePoint;
namespace CustomDocumentIDProvider.Components
class CustomDocumentIDProvider : DocumentIdProvider
public override string GenerateDocumentId(SPListItem listItem)
string retParam = "SPDocID-";
string path = Path.GetRandomFileName();
path = path.Replace(".", "");
retParam += path.Substring(0, 8).ToUpper();
return retParam;
public override string GetSampleDocumentIdText(SPSite site)
return "SPDocID-HT7G4SP7";
Kind regards,
Margriet Bruggeman
Lois & Clark IT Services
web site: http://www.loisandclark.eu
blog: http://www.sharepointdragons.com

Similar Messages

  • Unable to see existing documents in a Custom Sharepoint 2013 Document library while saving a document directly in it using explorer mode

    Hi,
    We have a SharePoint 2013 doc library based on a custom template, which has been migrated from 2010.
    We are unable to see existing documents in a Document library created using this template while saving a document directly in it using explorer mode, However we can save files and even see them in explorer mode, only when we try to save a new document there
    directly, we cant see the old docs.
    All the OOB libraries work fine.
    Below is the normal behavior while saving a file, however nothing comes up when saving on this custom template library

    Solved it myself guys... (Well the major part)
    Got help from here...
    https://www.nothingbutsharepoint.com/sites/devwiki/articles/pages/blank-open-save-dialog-when-browsing-document-library-from-office-clients.aspx
    and
    http://www.sharepointconfig.com/2011/02/vs2010-list-definition-template-missing-file-dialog-view/
    with some tweaks of my own..
    Still working on it because its showing SharePoint 2010 header... And I need 2013 look...

  • SharePoint 2013 document library workflow to send emails when document changes

    Hi All,
    Need a email alerts to setup when documents get change in a SharePoint 2013 document library.  Mail should go to all the members in a SharePoint Security group.
    Many Thanks 
    sudesh withanage

    Out of the box , You cannot set alerts for SharePoint group. You may try -
    1- Create a group in active directory, add users to the ADgroup. Add that ADgroup in Sharepoint and configure alert.
    2- You can set up a new user and change their email to that of a distribution list, and then assign the alerts to this user.
    3- You can create a custom workflow/action or event receiver that will send an email to a distibution list or programmatically traverse the SPGroup's members and send them the notification email, whenever an item is added or changed.
    4- You can try this , this was for WSS3 -
    http://advancedalert.codeplex.com/
    5- you can to use SharePoint Designer and create a workflow that send an email to SharePoint group.
    Thanks
    Ganesh Jat [My Blog |
    LinkedIn | Twitter ]
    Please click 'Mark As Answer' if a post solves your problem or 'Vote As Helpful' if it was useful.

  • Email attachments from SSRS email subscription are not being uploaded to an email enabled SharePoint 2013 document library

    Email attachments from SSRS email subscription are not being uploaded to an email enabled SharePoint 2013 document library.
    I have tested the library using a standard email (with attachment) to the library and this works fine. 
    I have monitored the drop folder on the server and I can see both emails being picked up in drop and processed by SharePoint.  The email sent from a regular email account is uploaded with the attachment, whereas the email sent via SSRS subscription
    email is uploaded and the attachment (report) is missing.

    An update on this.  The email when sending from SSRS subscription is received in the library and the attachment is contained within the .EML file uploaded.
    The behaviour that I would like from SSRS subscription emails are to just have the document and not the email.
    Below is a snippet of the .EML files I quick copied from the Drop folder.
    Email attachment snippet sent from SSRS Subscrption:
    ----boundary_2477_75fa3d73-56de-4948-ad82-6588f3a35b95
    Content-Type: application/octet-stream; name="Toilet Usage by Month.docx"
    Content-Transfer-Encoding: base64
    Content-Dis;
     filename="=?utf-8?B?VG9pbGV0IFVzYWdlIGJ5IE1vbnRoLmRvY3g=?="
    Content-ID: <10722c0f-749e-4ecb-ac3f-206317bae734>
    UEsDBBQAAAAIAEVcbEY4Xh4a5nsAAPJtMQARABwAd29yZC9kb2N1bWVudC54bWwgohgA
    KKAUAAAAAAAAAAAAAAAAAAAAAAAAAAAA7N1rr1/XcSforyL4VRooR3vd9to76Kihjto9
    I8T2TDvAzFuaPrE1kUiCouxWPv38DyX50nHSniCdyS96bIAUL+d/LnxO7Vq11qr6j//p
    v3/x+Qe/fnr75WevX/3lD9qfHz/44OnVy9e/+OzVL//yB1+9+9sfXj/44Mt3L1794sXn
    r189/eUPvn768gcf/KeP/uNv/uIXr19+9cXTq3cfPF7h1Zd/8evHH/7q3bs3f/Hhh1++
    /NXTFy++/PPXb55ePf7wb1+//eLFu8cv3/7ywy9evP27r9788OXrL968ePfZzz/7/LN3
    X3/Yj+P8wbcv8/rxXt+++otvX+KHX3z28u3rL1//7bvnN/mL13/7t5+9fPr2p+/e4os/
    5f1+8yaffPshv3+Pj4/l3a++e5Ff/1Pv9tdffP7d3/vNmz/lvf3i7YvfPL6AX3z+zTv6
    Email attachment snippet sent from Outlook:
    --_004_A4C6DCEDE4346446A79AFF493D278530FB87FA07MELABCDEXA1airp_
    Content-Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document;
     name="Toilet Usage by Month.docx"
    Content-Description: Toilet Usage by Month.docx
    Content-Dis; filename="Toilet Usage by Month.docx";
     size=76574; creation-date="Thu, 12 Mar 2015 00:41:14 GMT";
     modification-date="Thu, 12 Mar 2015 00:41:14 GMT"
    Content-Transfer-Encoding: base64
    UEsDBBQAAAAIAMJcbEY4Xh4a5nsAAPJtMQARABwAd29yZC9kb2N1bWVudC54bWwgohgAKKAUAAAA
    AAAAAAAAAAAAAAAAAAAAAAAA7N1rr1/XcSforyL4VRooR3vd9to76Kihjto9I8T2TDvAzFuaPrE1
    kUiCouxWPv38DyX50nHSniCdyS96bIAUL+d/LnxO7Vq11qr6j//pv3/x+Qe/fnr75WevX/3lD9qf
    Hz/44OnVy9e/+OzVL//yB1+9+9sfXj/44Mt3L1794sXnr189/eUPvn768gcf/KeP/uNv/uIXr19+
    9cXTq3cfPF7h1Zd/8evHH/7q3bs3f/Hhh1++/NXTFy++/PPXb55ePf7wb1+//eLFu8cv3/7ywy9e
    vP27r9788OXrL968ePfZzz/7/LN3X3/Yj+P8wbcv8/rxXt+++otvX+KHX3z28u3rL1//7bvnN/mL

  • How to Implement custom share functionality in SharePoint 2013 document Lib programmatically?

    Hi,
    I have created custom action for Share functionality in document library.
    On Share action i'm showing Model pop up with Share form with addition functionality.
    I am developing custom share functionality because there is some addition functionality related to this.
    How to Implement custom share functionality in SharePoint 2013  document Lib pro-grammatically?
    Regards,
    - Siddhehswar

    Hi Siddhehswar:
    I would suggest that you use the
    Ribbon. Because this is a flexible way for SharePoint. In my project experience, I always suggest my customers to use it. In the feature, if my customers have customization about permission then i can accomplish this as soon
    as possible. Simple put, I utilize this perfect mechanism to resolve our complex project requirement. Maybe we customize Upload/ Edit/ Modify/ Barcode/ Send mail etc... For example:
    We customize <Edit> Ribbon. As shown below.
    When user click <Edit Item>, the system will
    render customized pop up window.
    Will

  • Can't open MS Word .doc files from SharePoint 2013 document library?

    Hello,
    I have uploaded some MS Word files with .doc extension into a SharePoint 2013 document library, but they don't open when clicked.  I can do a number of things to the file, like view and edit properties, download and other things, but it does not
    open up when mouse clicked.  There are PDF files in the document library and they open up just fine.  Any ideas?
    I should add that MS Word 2010 .docx files can not be opened either.
    Thanks.
    Paul

    Hi,
    Whether you use office 2013.
    Considering this .doc file can be smoothly opened in Office if you downloaded it to your local, it indicates that the Word document and Microsoft Word doesn’t have any problems. The issue may be caused by the compatibility between Office
    and your site.
    1.Check whether you have the SharePoint OpenDocuments Class add on enabled at first.
    Internet Explorer >Tools iron > Manage add-ons >
    Choose to Show All add-ons. Find SharePoint OpenDocuments Class and make sure it’s enabled.
    2.go to Compatibility view settings > add your SharePoint site to compatibility view
    3.go to Internet Options,
    Advanced > Reset… > Check Delete personal settings and reset
    Security > Trusted sites > sites > add SharePoint sites to trusted sites
    4.If it doesn’t work, please open Word, go to Options > Trust Center > Trust Center Settings > Protected View > Uncheck all.
    Best Regards,
    Lisa Chen
    Lisa Chen
    TechNet Community Support

  • Connecting a SharePoint 2013 Document Library to Outlook 2010 client

    Good Day,
    Can someone please confirm if you can connect a SharePoint 2013 Document Library to Outlook 2010 client?
    I have seen articles, like the one shown below for Outlook 2013 to SharePoint 2013;
    http://www.sharepointgeoff.com/how-to-connect-a-sharepoint-2013-document-library-to-outlook-2013/
    Please provide a link to documentation to validate what Outlook Office versions will support viewing Document Library from Outlook client from a SharePoint 2013 Document Library.
    Thanks in advance for taking the time to review my request.
    Regards,
    Mark

    Hi Mark,
    Per my understanding, you might want to connect SharePoint 2013 Document Library to Outlook 2010 client application.
    Yes, SharePoint 2013 Document Library can connect to Outlook 2010 client application, the connecting process is similar as what SharePoint 2013 connect to Outlook
    2013 client application does.
    Thanks
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • SharePoint 2013 document library, permissions to upload and view shared document only

    SharePoint 2013 document library I want to give access to client where they can upload and view their uploaded document and can see all documents shared with them.
    I have managed to show all document shared with them only by deactivating a feature but now they can't upload any document, If I create a permission set to allow them to upload documents, they will see all other documents as well which are not shared with them.
    Any suggestions?

    Hi Sharaqat, the best way to handle your situation is to have a separate library or site for the client. You could use item level permissions per Thilosh, but fine-grained permissions become a major headache. You could also use web parts and audience
    targeting, but that's not truly secure.
    cameron rautmann
    I am thinking to have a separate document library for client, where they can upload/view/edit etc, we will upload documents in a "secure" library with a column saying this is a private document or public document, if we mark a document public,
    a workflow will move that document to the client's document library. I don't think there would be a problem to move a document from 1 library to another in a workflow.
    That's the easiest solution I have found so far.

  • 2GB of video file upload to SharePoint 2013 document library

    Hi All,
    We have a requirement of uploading a 2GB of video file to a SharePoint 2013 document library. Will there be any issue due to increasing the maximum file size?
    Many Thanks,
    sudesh withanage

    It will be better if you save all your videos at one location,i.e Asset Library.Check the link for Asset libraries
    http://technet.microsoft.com/en-us/library/ee414275(v=office.15).aspx
    In case you want to add other files (i,e excel ,word) along with videos you will need to increase library size,
    Check the following link to increase the file size ,as well as the issues and workaround to solve the problems
    http://blogs.technet.com/b/praveenh/archive/2012/11/16/issues-with-uploading-large-documents-on-document-library-wss-3-0-amp-moss-2007.aspx
    Please Mark it as answer if this reply helps you in resolving the issue,It will help other users facing similar problem

  • SHarepoint 2013 - Document Conversion issue

    Hi All,
    I enabled Document conversion features in my SharePoint environment successfully and its working fine.
    i enabled word to html conversion option , it works fine when i try to convert the document with out any images in that document , i have some png images in that documents when i try to convert the document i got some error message like png images is not
    loading and my html page is showing with out any images , can any one help me to resolve this issue ASAP.
    Thanks,
    Mani L
    Mani L

    Hi Mani,
    According to your description, my understanding is that you want to use Document conversion features to convert documents with images to HTML page in SharePoint 2013.
    There is not an OOB way to achieve it. You can use Word to publish to a SharePoint blog which automatically uploads any images in the document. Then, you copy the html markup from the blog post and paste it into a wiki page.
    In addition, for this issue, you can also use a tird party tool to achieve, like the below:
    http://www.kaboodlekonnect.com/colin/Lists/Posts/Post.aspx?ID=19
    Here are some similar posts for you to take a look at:
    http://www.ericshupps.com/2013/05/converting-word-documents-to-html-in.html
    http://social.technet.microsoft.com/Forums/sharepoint/en-US/f45267b8-82e6-4cca-8541-d88a54740979/converting-ms-word-documetation-with-images-into-a-wiki-page-in-sp-2010?forum=sharepointgeneralprevious
    I hope this helps.
    Thanks,
    Wendy
    Wendy Li
    TechNet Community Support

  • Getting List of files of .wmv extension from a library \ folder in sharepoint 2013

    I need to get all the files from a particular folder in sharepoint library.
    I am using RESTAPI Javascript code as below : 
      var call = jQuery.ajax({
                    url: _spPageContextInfo.webAbsoluteUrl + "/_api/web/GetFolderByServerRelativeUrl('" + folderName + "')/Files",
                    type: "GET",
                    dataType: "json",
                    headers: {
                        Accept: "application/json;odata=verbose"
    This code retrieves all the files in a particular folder, except files with extension of .wmv.
    The count of files retrieved also doesnt include .wmv files.
    Can anyone tell me why this is happening.
    Thanks

    Hi,
    As this is not an expected outcome when requesting files of a library, a suggestion is that please create a new library and upload one sample .wmv file to it and send the request
    again to see if it is an issue of Document Library.
    Feel free to reply with the test result if the issue still exists or there any progress.
    Thanks
    Patrick Liang
    Forum Support
    Please remember to mark the replies as answers if they
    help and unmark them if they provide no help. If you have feedback for TechNet
    Subscriber Support, contact [email protected]
    Patrick Liang
    TechNet Community Support

  • Remote upload into sharepoint 2013 document library (cloud based)

    We have a sharepoint 2013 in the cloud.
    Is it possible to have some kind of service (windows or web based) that can access a document library on said cloud server and put files into said document library?
    I don't think we have a lot of behind the scenes access to the cloud instance of 2013.

    Hi,
    As I said above, we could use the Client Object Model to upload the files without the user having to go to SharePoint in the browser first and logging in.
    We can use the credentials in the code as below, the code would copy files to SharePoint online, it worked well in my environment, you can check whether it works.
    public static void CopyDocuments(string srcUrl, string srcLibrary, string destUrl, string destLibrary)
    // set up the src client
    ClientContext srcContext = new ClientContext(srcUrl);
    SecureString passWord1 = new SecureString();
    foreach (char c in "Password01!".ToCharArray()) passWord1.AppendChar(c);
    srcContext.Credentials = new SharePointOnlineCredentials("[email protected]", passWord1);
    Web srcWeb = srcContext.Web;
    List srcList = srcWeb.Lists.GetByTitle(srcLibrary);
    ListItemCollection itemColl = srcList.GetItems(new CamlQuery());
    srcContext.Load(itemColl);
    srcContext.ExecuteQuery();
    // set up the destination context
    ClientContext destContext = new ClientContext(destUrl);
    SecureString passWord = new SecureString();
    foreach (char c in "Password01!".ToCharArray()) passWord.AppendChar(c);
    destContext.Credentials = new SharePointOnlineCredentials("[email protected]", passWord);
    // get the destination list
    Web destWeb = destContext.Web;
    destContext.Load(destWeb);
    destContext.ExecuteQuery();
    foreach (var doc in itemColl)
    try
    //if (doc.FileSystemObjectType == FileSystemObjectType.File) //Field or Property "FileAttachement not found."
    // get the file
    File file = doc.File;
    srcContext.Load(file);
    srcContext.ExecuteQuery();
    // build destination url
    string nLocation = destWeb.ServerRelativeUrl.TrimEnd('/') + "/" + destLibrary.Replace(" ", "") + "/" + file.Name;
    // read the file, copy the content to new file at new location
    FileInformation fileInfo = File.OpenBinaryDirect(srcContext, file.ServerRelativeUrl);
    File.SaveBinaryDirect(destContext, nLocation, fileInfo.Stream, true);
    catch (Exception ex)
    http://blog.blumshapiro.com/blog/2012/08/22/sharepoint-2010-using-the-client-object-model-to-move-files-and-folders-across-site-collections-and-subsites/
    Thanks,
    Jason
    Forum Support Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected].
    Jason Guo
    TechNet Community Support

  • Update Sharepoint 2013 document library folder columns using document url

    Hi All,
    I have a SharePoint document library. In that library I am having folder name called Folder1. In this folder Folder1 I have 4 files in it. Now. I need to update the status column of these 4 files in Folder1 folder using the url of these 4 files.
    So can anyone help me in to solve this problem. I am using SharePoint 2013 and Visual studio 2012. I want the code in C#.
    Thanks & Regards,
    Kishore
    Kishore

    Hi,
    According to your post, my understanding is that you want to update the field within the folder.
    I have made a simple code demo below to update the field within the folder, you can have a look at it.
    using (SPSite site = new SPSite("http://YourSiteURL"))
    using (SPWeb web = site.OpenWeb())
    SPList list = web.Lists.TryGetList("Lib1");
    if (list != null)
    foreach (SPListItem folderItem in list.Folders)
    if (folderItem.Title == "Folder1")
    SPListItem item = list.GetItemById(5);
    item["Status"] = "Updated";
    item.Update();
    Console.WriteLine("Field update successfully...");
    Thanks & Regards,
    Jason
    Jason Guo
    TechNet Community Support

  • How to retrieve full flash solution from WSP if not than how to retrieve ascx files from Template folder in SharePoint 2013 ?

    How to retrieve ascx file from the Template folder in SharePoint2013
    My issue is, I have WSP only so I changed into zip and got my all web parts and also one dll file after that decrypted dll and got some C# code
    mixing with some system generated code but not ascx file that is for front-end part. So my question is how we can retrieve full flash solution if not, at least ascx files So if we were on SharePoint 2010 we could have got those file from __Template__
    folder but It’s on SharePoint 2013 and not able to get ascx.
    If we can do so, than will be easy to get the task to be done
    Suggestions would highly be appreciated. Thanks in Advance.
    Ashish

    Hi Amit,
    you can not move specific changes from Dev to production.
    but you can follow this process to make your workflow as it is as in Dev:
    Create a new workflow on the new list in Product.
    Create at least one step, one condition and one action in this workflow.
    1. In Dev server open your .xomal file as XML and copy the entire contents.
    2.In Production server Open your .xoml file as XML and Paste the entire contents
    3. repeat this operation for the xoml.rules file
    4.Double click the .xoml file for the new workflow to open the workflow in the Workflow Designer and click Check Workflow to verify no errors and then click Finish to ensure the workflow is saved.
    Whenever you need to make changes apply the same.
    Please Mark Answer and Vote me if it will to resolve your issue

  • Sharepoint 2013 Document Library MetaData Key Filter

    Hello,
    I created a document library with some fields like Client Name(text), Client Type(choice), Document Type(choice). After that  I would like to use that metadata to help me to search documents. I realized that only choice fields are included in the
    key filetr(Client type and Document Type). Is there any way to add the client Name in the Key Filter section, so I can search documents by client name also.
    I am not sure if this problem can be fixed using metadata key filter or I should create a folder structure in the document library to do what I need.
    If you have any advise about the best way to impolement this problem will be appreciate.
    Thank in advance.
    Jhonny Marcelo

    Yes you can do that. 
    You  need to add custom column to get indexed  and the use it on search results page. Try below:
    http://www.tautic.com/refining-a-moss-search-to-a-column-value
    http://www.sharepointtalk.net/2011/10/using-custom-fields-in-search-results.html
    http://waelmohamed.wordpress.com/2011/05/31/add-custom-search-properties-in-your-advanced-search-sharepoint-2010/

Maybe you are looking for