You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have found a strange issue, if you have any ideas, I am all ears.
I am trying to programatically upload and set a word document as a template on a new list content type.
I can create the Site content type OK
I can upload a file to SiteAssets (*.docx) OK
I can retrieve the Site content type OK
I can then set the template to the URL of the uploaded file OK
I can add the site content type to a document library OK
I can do this TWO times OK
However
When I create an item in the doucment library with the second content type, it allocatest the FIRST content type to the new document.
If I attempt to CHANGE the content type back to what is was created with I get the error:
Error: The file is locked for shared use by {me}
If I wait around for a few minutes then the lock seems to go and i CAN change the conent type:
Workaround
My current workaround is to go back to the content type directly, use "advanced settings" and then upload the file again to the content type.
When I do this it all works correctly and content type fields are correctly set to the content type being used when creating the item.
I can't seem to find a pnp.Core mechanism to mimic the mechanism behind "Upload a new document template"
when editing a content type
The only mechanism available seems to be to use the
"Enter the URL of an existing document template"
Which I can't get working
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I have found a strange issue, if you have any ideas, I am all ears.
I am trying to programatically upload and set a word document as a template on a new list content type.
I can create the Site content type OK
I can upload a file to SiteAssets (*.docx) OK
I can retrieve the Site content type OK
I can then set the template to the URL of the uploaded file OK
I can add the site content type to a document library OK
I can do this TWO times OK
However
When I create an item in the doucment library with the second content type, it allocatest the FIRST content type to the new document.
If I attempt to CHANGE the content type back to what is was created with I get the error:
Error: The file is locked for shared use by {me}
If I wait around for a few minutes then the lock seems to go and i CAN change the conent type:
Workaround
My current workaround is to go back to the content type directly, use "advanced settings" and then upload the file again to the content type.
When I do this it all works correctly and content type fields are correctly set to the content type being used when creating the item.
I can't seem to find a pnp.Core mechanism to mimic the mechanism behind
"Upload a new document template"
when editing a content type
The only mechanism available seems to be to use the
"Enter the URL of an existing document template"
Which I can't get working
I checked CSOM and it has the same limitations!
Any ideas anyone?
Thanks
Beta Was this translation helpful? Give feedback.
All reactions