ApendDocLink - Authorization problem

I have some LS code in a database which is causing the error message:

Notes Error: You are not authorized to perform that operation

The code causing the error is within a script and is given below

The line that generates the error (when run thru debug) is

Call RTitem.AppendDocLink(in_LinkTo,“Click here to bring up the document this message relates to”)

Function SendDocLink(in_To As Variant, in_CC As Variant, in_BCC As Variant, in_Subject As String, in_Body As String, in_ViewIcon As Integer, in_LinkTo As Variant)

On Error Goto ErrorSending

Print "Sending Notification"

SendDocLink = True    



Dim CurSession As New NotesSession

Dim CurDB As NotesDatabase

Set CurDB = CurSession.CurrentDatabase

Dim RTitem As NotesRichTextItem

Set MailDoc = New NotesDocument(CurDB)



MailDoc.Form = "Bookmark"

MailDoc.SendTo = in_To

'MailDoc.SendTo = "Peter Kempner/Novelis"



MailDoc.CopyTo = in_CC

MailDoc.BlindCopyTo = in_BCC



Set RTitem = New NotesRichTextItem(MailDoc,"Body")

Call RTitem.AppendDocLink(in_LinkTo,"Click here to bring up the document this message relates to")



MailDoc.InheritedDbTitle = CurDb.Title

MailDoc.Subject = in_Subject

MailDoc.FlowStatus = in_Body

Call MailDoc.ReplaceItemValue("_ViewIcon", in_ViewIcon)

Call MailDoc.Send(False)

Print ""

Exit Function

ErrorSending:

Messagebox Error()	

Messagebox "FYI:  One or more recipients could not be notified via email at this time.", 0 + 64, "Please note..."

SendDocLink = False

Exit Function

End Function

This routine works fine for me but not for my users.

They are set up as -Default- with Editor access in the ACL whereas I am set up with Manager access

I have looked in the help and on the forum and cannot find anything relating to access restrictions for this method.

Many thanks for any ideas

Pete

Subject: ApendDocLink - Authorization problem

Pete,

It depends on what you are passing to your SendDocLink function for the inLinkTo variable. Could you post the code where you call the function? Because we aren’t seeing what you are passing to that value in the function alone.

Brandt

Subject: RE: ApendDocLink - Authorization problem

The calling function is given below

SendOK = SendDocLink(DeptNotificationList, “”,“”,xSubject$, xBody$, nIcon%, CurNote)

Where

xSubject$ = “Haulier Invoice Requires Actioning”

xBody$ = “The invoice below has been OK’d by the Transport Department and now requires Purchase Ledger to complete it.”

nIcon% = 0

CurNote is the NotesDocument

Subject: RE: ApendDocLink - Authorization problem

How do you assign the CurNote object? what database is it coming from?

Subject: RE: ApendDocLink - Authorization problem

CurNote is assigned n the PostOpen event of the database.(There is only 1 database involved)

Sub Postopen(Source As Notesuidocument)

Dim CurWS As New NotesUIWorkspace

Set Cursession = New NotesSession	

Set  CurDB = CurSession.CurrentDatabase

Set CurSource = Source

Set CurNote = CurSource.document      



If CurSource.IsNewDoc Then          

	CurNote.InvoiceStatus  = "DRAFT"

	Curnote.InvoiceNumber = "- New Invoice -"

	Cursource.Refresh

End If

Dim uidoc As NotesUIDocument

Set uidoc = curWS.CurrentDocument



If Curnote.InvoiceStatus(0) = "COMPLETE" Then

	uidoc.EditMode = False

Else

	uidoc.EditMode = True

End If

End Sub

Subject: RE: ApendDocLink - Authorization problem

Pete,

Is CurNote a global variable? Does the document in question have any readers fields on it?

Brandt

Subject: RE: ApendDocLink - Authorization problem

Brandt,

Curnote is a global variable and there are no reader fields.

It seems weird that a command like ApendDocLink should have an undocumented security issue like this.

Although no one else has reported it so it is probably something silly that I have overlooked!

Thanks for your help.

Pete

Subject: RE: ApendDocLink - Authorization problem

GOT IT!!!

For AppendDocLink to work, user must have access to the Default View

Thanks for your help Brandt

Pete

Subject: RE: ApendDocLink - Authorization problem

Pete,

Where did you find that? In the forum? The documentation doesn’t say anything…

I’ll have to file that one away…although I learned long ago to not restrict access to the default view…it will stop a user from even getting into the db…

glad to be of what limited assistance I could be…

brandt

Subject: RE: ApendDocLink - Authorization problem

I Googled “AppendDocLink Notes Error”

and went to

http://www-1.ibm.com/support/docview.wss?uid=swg21105197

Which said

Problem

When a particular user executes a LotusScript agent that includes the AppendDocLink method (of the NotesRichTextItem class), the following error occurs:

“Notes error: You are not authorized to perform that operation.”

Solution

This error occurs when the user who runs the agent does not have access to the default view for the database. A report has been submitted to Lotus Quality Engineering to update the documentation so it indicates the need to have a default view when using the AppendDocLink method.

I particularly like the bit about the documentation!!

Cheers again,

Pete