0

Been searching through the internet for a couple of days to no avail but how do you create Asset Library with BaseTemplate = 851 in modern sites for Sharepoint Online via the REST API V1.0 endpoint? I am able to create Lists, Document libraries & Picture libraries with no issues but when I use BaseTemplateId = 851 the REST endpoint is not accepting the payload.

data = JSON.stringify({
        "__metadata": {"type": "SP.List"},
        "AllowContentTypes": true,
        "BaseTemplate": 851,  
        "ContentTypesEnabled": true,
        "Description": "My list description",
        "Title": foldername
      
    })

headers.append("Authorization", bearer)
headers.append("Content-Type", "application/json;odata=verbose")
headers.append("Accept", "application/json;odata=verbose")
headers.append("X-RequestDigest", formDigestValue)
const options = {
    method: "POST",
    headers: headers,
    body: data
};

return fetch(folderPath + '/_api/web/lists', options)
    .then(response => response.json())
    .then(response => console.log(response))

BaseTemplate - 100, 101 & 109 are just working fine and I am able to create lists and document libraries. 851 is not working programmatically though I can create Assets Library manually ( I have activated Video and Rich Media Site Collection Features).

Any help here would be much appreciated! Thank you

0

To my knowledge, you can´t create an AssetLibrary with REST.

You can create it with PnP PowerShell.

New-PnPList -Title "Test Asset Library" -Url "Lists/TestAssetLibrary"  -Template AssetLibrary
1
  • thanks for the reply. We have a web-facing SPA with react which is also a PWA. It is not possible to run powershell on a client device. I see other apps like Team, Power Automate that can create asset libraries so I am wondering if there is a way to create AssetLIbraries on the fly with REST esp considering all other libraries and lists can be created. Also, I have seen C# code that does the same via CSOM. Can you suggest any other way of doing this via Javascript? Our App is not running within the Sharepoint context but a separate application on its own. Thank you Jul 26 at 5:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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