How does OCs directly add Contacts to users in the database?

Source: Internet
Author: User

1.First, you must use Select resourceid from resource where userathost = 'ddddddd ',Find the contacts you want to add and the contactsResourceid.

2.SearchTable contactgroup,Find all your records and write down the records

Select * From contactgroup where ownerid = xxx --- xxxIt's yours.Resourceid

3.In your ownOCSAdd a group

4.InTable contactgroupFindDislayname,The method is

Select * From contactgroup where ownerid = xxx ---- xxxIt's yours.Resourceid

Find the new line and write downDislaynamFor example0xe8b387e8a88ae782bae682a8e69c8de58b99

5.Insert into contactgroup values (XXX1, 999, 0xe8b387e8a88ae782bae682a8e69c8de58b99, 0x)

XXX1You want to add Contacts.Ownerid, That isResourceid,999YesGroupid,Do not take1And others. In order not to conflict with the original user999The third section is the name of the group you want to add. I don't know what the last code is, but I found that the system is0x

6. insert into contactgroupassoc values (XXX1, xxx2, 999)

Where,XXX1You want to add Contacts for that user.Ownerid, xxx2You want to addXXX1Contact.

Now, the added contacts are displayed after you log on again.

Based on the above method, you can add Contacts in batches or even writeTrigger,Automatically add Contacts to new users or add new contacts when they are deleted.

In addition to this method, you can also modify the stored procedure that comes with the system to complete the above work.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.