Hello everyone,
if this is the wrong forum for my question, take my apologies and please guide me to the correct forum...
I do want to rename a file (saved to sharepoint) based to the header name with CRMscript. But at least for our tenant, this does not work.
The script basically does this:
String myNewHeader = myWantedHeader + docheader;
String myDocumentName = myWantedHeader + docheader + ".docx";
thing.SetHeader(myNewHeader);
thing.SetName(agent.RenameDocument(myDocID, myDocumentName));
agent.SaveDocumentEntity(thing);
The Header is set right, but the document does not seem to be renamed in sharepoint.
Also i do not get any error message - it just does not work.
Am i doing something wrong here?
Thanks and kind regards
Joerg Hermanns
All Replies (4)
Hello Jörg,
I'm a little unsure about your code-snippet. Specifically this line:
```
thing.SetName(agent.RenameDocument(myDocID, myDocumentName));
```
Is there a reason why you use the RenameDocument on the Agent in this way?
May I suggest you just set the name directly instead?
```
#setLanguageLevel 4;
NSDocumentAgent dAgent;
NSDocumentEntity dEntity = dAgent.GetDocumentEntity(59);
dEntity.SetName("NewName.docx");
dAgent.SaveDocumentEntity(dEntity);
```
That being said I can reproduce the issue with renaming documents when you use sharepoint. I'm looking into it and will get back to you in this thread when i have more information, hopefully the first part of next week.
Have a SUPER day!
//Eivind
Hello Jörg,
After digging into this there seems to be an issue with renaming files that are stored in sharepoint.
We have created a bugreport on it, hopefully it will get fixed in the future..
Sorry!
//Eivind