简体   繁体   中英

Create new document in .nsf file using interop.domino.dll c# specially a contact under user

I am trying trying to create a new contact under a specific user. My contact is created successfully but I am not able see my contact in $Contacts View instead of that that is exist under (Recently Archived) folder of the username.nsf file. How can create a new document under $Contacts View . This is the code snippet which I used to create new contact document.

NotesDatabase _localDatabase = _lotusNotesServerSession.GetDatabase("servername", "mail/username.nsf", false);                   

if(!_localDatabase.IsOpen)
{
    _localDatabase.Open();
}                  

NotesDocument contact = _localDatabase.CreateDocument();
contact.ReplaceItemValue("First Name","Test");
contact.ReplaceItemValue("Last Name", "Contact ");
contact.ReplaceItemValue("Mail Address", "testcontact@domain.com");
contact.ReplaceItemValue("Full Name", "Test Contact");
bool issuccess = contact.Save(true,false,false);

If you open the two views in Domino Designer, you'll see the criteria for which documents appear in each (the View Selection formula). The selection formula for ($Contacts) requires any document to have the Form field set to "Person" or "Group". You're not setting the Form field. So just add contact.ReplaceItemValue("Form","Person") and you'll solve the problem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM