I am creating a document library using C# code in Office 365. I am creating some site columns and adding in a content type. I am associating this newly created content type to my document library. When I upload the document, "ID" starts with 2 or 3.

I tried following things:

  • checking recycle bin, recycle bin is empty.

  • tried REST query - <<'SiteUrl'>>/_api/Web/Lists/GetByTitle('<<'ListName'>>')/Items(1), it gave me 404.

Why ID is not starting with 1.

Thanks in advance.

Additional Details: When I create simple document library and upload document in it, ID is starting with 1.

When I create document library and a custom content type. I associate content type with document library. ID is starting with 2.

  • can you try creating document library from UI and check if index starting from 1 or 2.
    – Aanchal
    Jun 19, 2014 at 10:02
  • I tried to create document library using UI, ID is starting with 1. When I created Document library with custom content type(created from UI), ID is starting from 2
    – AkshayP
    Jun 19, 2014 at 10:05

1 Answer 1


Whenever you add a content type that has a document template it increases the NextAvailableId in the database.

For example if you add content type Picture which has no document template it will not increase NextAvailableId but if you add Form, Document or any content type that adds a document template it will use an ID and increase NextAvailableId.

The Url of the new document template added with those content types are like


That's not an item that you get from SPList.Items but it's there and uses an ID.

That's how they've done it and I think there's nothing you can do about it when your content type adds a document template.

  • Naim Murati is correct. If you REALLY want to start at 1, you can try removing all existing content types from the list first, then add your new one to get ID 1 as your first document. But that seems like a lot of work to start counting at 1 instead of 2.
    – parkanian
    Jan 15, 2018 at 16:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.