Permission Denied when renaming file in filesystem

Hello folks,

What i’m trying to do is to create an agent that will rename an attachment in a given notesdocument. the interesting code used is below:

’ setup

Set db = s.currentdatabase

Set docref = s.documentcontext

Set docAttach = db.GetDocumentByUNID(docref.docs(0))

filepath$ = "c:\TEMP\"





' get attachment name

attachname = Evaluate({@AttachmentNames},docAttach)



' setup an obj handler 

Set obj = docAttach.GetAttachment(attachname(0))



'setup old and new filename to filesystem operations

oldFileName = filepath$ + obj.Name

newFileName = filepath$ + docAttach.newFileName(0)



'extract the attachment to filesystem

obj.ExtractFile(oldFileName)



'setup attribute as normal, to allow read-write ( not really necessary, but who knows?)

Setfileattr oldFileName, ATTR_NORMAL



'remove attachment

Call obj.Remove



'rename the attach to a new name

Name oldFileName As newFileName



'recreate attach

Set arquivo = docAttach.CreateRichTextItem("arquivo")

Set objNew = arquivo.EmbedObject( EMBED_ATTACHMENT, "", newFileName)





'Save notesdocument

Call docAttach.Save(True,True)



'cleanup filesystem

Kill newFileName

As u can see the code is very simple. But im getting an “error 70: permission denied” error in line - Name oldFileName As newFileName .

Configurations:

  1. Agent is running with restricted operation with full admin rights

  2. Agent running with server´s id.

  3. Using c:\temp as filesystem folder to agent operations and it has all rights to everyone trying to access/modify/add it !

Im almost sure that is a filesystem case, and as i dont understand pretty much 'bout that im here asking you guys some tips on it !!

any help would be great!

TIA ,

/fferrandini

Subject: Permission Denied when renaming file in filesystem

no more help needed

actually it was a LS error.

thanks!