There may be other ways but I use the "CopyIntoItemsLocal" method. I maintain a master library of templates (all kinds of file types) in a read-only library. I have a simple page set up for a user to select a template to use (and provide me a couple other details). Based on some other factors that I look up on the fly, my code figures out what thte metadata should be and where to store a copy of the template, then fires the copy function. After the copy operation is complete, I look up the new item by its "FileRef" property to get the ID. Using the ID, I run the UpdateListItems function on that ID to update metadata. At the end of the script, the page redirects to the target destination library/folder.
↧