Hi -
We have a situation please assist with your expertise.
We are writing the custom code to copy file and assigning the ListItem properties into our "Sandbox" document library based on selected template from "Document_Template" document library. The "Sandbox" document library uses a custom content type.
1. Here we first copy the selected template file from "Document_Template" document library to our "Sandbox" document library
2. Then get the ListItem from the copied file into the "Sandbox" document library.
3. Modify the ListItem properties (fields) and assign proper permission on the ListItem of "Sandbox" document library
This process works like charm -
We have created template of "Sandbox" document library by save as template, so that 1000+ Sandbox libraries can be created based on it.
Once we create new Sandbox library from the template, and try to create new document by selecting the template the process is failing at step 2 i.e. copied file item property is null
//Copies the file to the sandbox location from "Document_Template" document libraryselectedTemplateFile.CopyTo(sandboxUrl + selectedTemplateFile.Name);
//Get the list item from copied file and modify properties.
SPListItem sandboxDocumentItem = sandboxFileExist.ListItemAllFields;
or
SPListItem sandboxDocumentItem = sandboxFileExist.Item;
Thanks in advance !!
Amit