Trouble with MoveUserInHierarchyComplete... "Invalid Approval Request note"

Hi, I am trying to simply loop through the adminP database to try to approve requests for moving user’s to a new hierarchy. I successfully obtain the correct document, but I receive the following error:

Invalid Approval Request note - Error #4564

Has anyone solved this problem? Thanks.

Eric

Here is the relevant code:

Dim session As New NotesSession

Dim thisdb As NotesDatabase

Set thisDb = session.CurrentDatabase

Dim cnServerName As String

Dim serverName As New NotesName(thisDb.Server)

cnServerName = serverName.Canonical



' Connect to the AdminP database on the current server

Dim adminpDb As NotesDatabase

Set adminpDb = session.getDatabase("", "admin4.nsf")



' Retrieve the view that contains requests waiting for user action

Dim adminpView As NotesView

Set adminpView = adminpDb.GetView("Name Move Requests")



' Get the first documents from the AdminP collection

Dim adminpDoc As NotesDocument

Set adminpDoc = adminpView.getFirstDocument()



' Set up the AdminP process on the server

Dim adminp As NotesAdministrationProcess

Set adminp = session.CreateAdministrationProcess(serverName.abbreviated)

adminp.CertificateAuthorityOrg = "OU=My OU/O=MyOrg"

adminp.UseCertificateAuthority = True



Dim adminpResponses As NotesDocumentCollection

Dim proxyAction As String

Dim proxyAuthor As String

Dim docType As String

Dim noteId As String

While Not(adminpDoc Is Nothing)

	proxyAction = adminpDoc.GetItemValue("ProxyAction")(0)

	proxyAuthor = adminpDoc.GetItemValue("ProxyAuthor")(0)

	docType = adminpDoc.GetItemValue("Type")(0)



	If (Lcase(docType) = "adminrequest") Then

		If (Lcase(cnServerName) = Lcase(proxyAuthor)) Then

	' If the action is to move the user

			If (proxyAction = "6") Then

				Set adminpResponses = adminpDoc.Responses

				If (adminpResponses.Count = 0) Then

					noteID = adminp.ApproveMailFileDeletion(adminpDoc.noteid) 

				End If

			End If

		End If

	End If

	

	Set adminpDoc = adminpView.GetNextDocument(adminpDoc)

Wend