Accessing Profile Document Problem

Hi Forum Members,

I have the following sceanrio:

User A → mail file A

User B → mail file B

‘A’ is having delegation access over mail file ‘B’. Now I logged in using user account of user ‘A’ and accessed databse file ‘B’ ie of user B. When I tried to access profile document in this database then I used two way

First using:

DocumentCollection dc = database.getProfileDocCollection(“CalendarProfile”);

Second Using:

Document doc = database.getProfileDocument(“CalendarProfile”, session.getUserName());

For the first approach I got it working but for the second I am getting following exception:

NotesException: Notes error: You are not authorized to perform that operation (CalendarProfile).

Unable to find out the reason for it. Any help in this regards will be appreciated.

Thanks in Advance

Will Turner