Prepopulate Messenger Contact list

Last post 10-31-2010, 10:32 PM by strikingknife. 10 replies.
Sort Posts: Previous Next
  •  10-21-2010, 4:14 AM 64552

    Prepopulate Messenger Contact list

    Hi Guys,
     
    It will be great if you can advise or give me sample code to add a contact list for an user via .Net code.
     
    I need to integrate with SharePoint 2007
     
    Currently i managed to integrate with sharepoint 2007 it is working like charm.
     
    Just need to do bit more customisation to prepopulate the Contact List
     
    Will be really great if you can help me on this.
     
    Kindly advise
     
    Thanks and Regards,
     
     
    Filed under:
  •  10-21-2010, 9:22 PM 64588 in reply to 64552

    Re: Prepopulate Messenger Contact list

    Hi strikingknife,
     
    The code below shows you how to add user "merry" into the contact list of user "jack"
     
      protected void btnAdd_Click(object sender, EventArgs e)
        {
            CuteChat.ChatPortal portal = CuteChat.ChatSystem.Instance.GetCurrentPortal();
            lock (portal)
            {
                CuteChat.ChatIdentity myid = new CuteChat.AppChatIdentity("nickname", false, "User:jack", "0.0.0.0");
                portal.DataManager.AddContact(myid, "User:merry");
            }
        } 
     
    Regards,
     
    Ken 
  •  10-22-2010, 3:08 AM 64618 in reply to 64588

    Re: Prepopulate Messenger Contact list

    Hi Kenneth,
     
    The code works good

     
    I am having some problems in the add contact window
     
     i managed to replace the existing Add Contact window by uncommenting the section as shown below in the ChatUI.js
     
    function ChatUI_ShowAddContact()
    {
        OpenWindowWaitReturn(_ChatUI_ShowAddContact_Return, CuteChatUrlBase + "IM_AddContact.aspx", "", "resizable=1,status=0,menubar=0," + GetOpenWindowSizeText(577, 390));
        
    //    function OnPrompt(name)
    //    {
            //if(name)
            //{
            //    ChatUI_AddContactByName(name)
            //}
    //    }
        //Desktop.Prompt(OnPrompt,TEXT("UI_CONTACT_AddContact_subTitle"),TEXT("UI_MENU_AddContact"));
    }
     
    If i do so, my contact is added intermittently and i am not able to remove the contact as well.
     
    Kindly let me know if i need to have my own page how can i change the js to support this feature
     
    if you can provide me sample code on how to integrate customadd contact with Messenger, it will be great
     
    Thanks and Regards,
     
     
     
     
     
    Filed under:
  •  10-22-2010, 3:35 AM 64623 in reply to 64618

    Re: Prepopulate Messenger Contact list

    Hi strikingknife,
     
    That code just use for the user click on the " Add contact" button, if you handle all contact lists of user by code. Delete the code will not be affected.
     
    my contact is added intermittently", this happen when add contact by code or by click the " add contact" button?
     
    If you mean by the "add contact" button, it is correct, because you comment the pop up code. 
     
    Maybe you can explain your requirement on detail why you need to comment this code, so I can show you how to achieve it.
     
    Keep me posted.
     
    Regards,
     
    ken 
  •  10-22-2010, 4:09 AM 64625 in reply to 64623

    Re: Prepopulate Messenger Contact list

    Hi Kenneth,
     
    The Requirements are as follows.
     
    The users would like to use sharepoint people picker to add contacts instead of manually adding the
     
    user name in the add contacts default box.
     
    Thats why i need to create a custom Add contact page to support this feature
     
    it will be great if you can direct me on how to do this
     
    Your help will be appreciated
  •  10-22-2010, 4:36 AM 64627 in reply to 64625

    Re: Prepopulate Messenger Contact list

    Hi strikingknife,
     
    Your method and logic are correct. 
     
    I think you do not want the pop up message show after the user add into the contact list right?
     
     
    Try this way
     
     1. Open file "\CuteSoft_Client\CuteChat\Script\ChatUI.js"
     
    2. Find section below and delete it
     
    case "CONTACT_ADDED":
    msgtext=TEXT("UI_CONTACT_ADDED",info1[0]);
    break; 
     
    Regards,
     
    ken 
  •  10-23-2010, 12:00 AM 64648 in reply to 64627

    Re: Prepopulate Messenger Contact list

    Hi Kenneth,
     
    I was telling you abt the inserting intermittently rite.
     
    It still exsists even after commenting off the javascript.
     
    The Scenario is as follows
     
    1. Select a User and Add to Contact List via Code.
    2. The Details are shown in the database and in the Messenger UI as well.
    3. Relog in again or Refresh the Messenger.aspx, the contacts are lost and the database value is also updated to 
    arr,S-0=
     
    If i use default add contact i dont have any of this problem ?. Is there any settings need to be done.
     
     
    Will you be able advise why is this happening ?
     
     
  •  10-24-2010, 10:19 PM 64660 in reply to 64648

    Re: Prepopulate Messenger Contact list

    Hi strikingknife,
     
    Can you test the steps/code on the download package demo?
     
    Demo download: http://www.cutesoft.net/downloads/folders/21915/download.aspx 
     
    If allow, please send me the test page url to Kenneth@CuteSoft.net, I will check it and get back to you as soon as possible. 
     
    Regards,
     
    ken 
  •  10-28-2010, 6:11 AM 64749 in reply to 64660

    Re: Prepopulate Messenger Contact list

    Hi Kenneth,
     
    I tried the sample code and it does not work properly, when i click the messenger/chat i had the error message LoadSettings.aspx failed.
     
    I tried this as a normal asp.net  website. Anyway we dont worry abt that first.
     
    My priority is to integrate with sharepoint.
     
    Please download the code from the following url asap since it will expire in few days
     
     
     
    Kindly let me know what is wrong in the custom contact page ?
     
    Really appreciate your help
     
    Thanks and Regards,
    Filed under:
  •  10-29-2010, 3:18 AM 64783 in reply to 64749

    Re: Prepopulate Messenger Contact list

    Hi strikingknife,
     
    In you chat provider, you have the below code. In this method we provide the "loginName" for you to get the user, so please do not use the current user string LoginName = System.Security.Principal.WindowsIdentity.GetCurrent().Name.ToString();  to get the user info.
     
    Try change
     
     SPUser mSPUser = mWeb.AllUsers[LoginName]; 
     
    To
     
     SPUser mSPUser = mWeb.AllUsers[loginName]; 
     
    1. public override bool GetUserInfo(string loginName, ref string nickName, ref bool isAdmin)  
    2.         {  
    3.             bool User = false;  
    4.             string NickName = string.Empty;  
    5.             string LoginName = System.Security.Principal.WindowsIdentity.GetCurrent().Name.ToString();  
    6.             bool Admin = false;  
    7.             SPSecurity.RunWithElevatedPrivileges(delegate()  
    8.             {  
    9.                 using (SPSite mSite = new SPSite(GetCurrentSiteURL()))  
    10.                 {  
    11.                     using (SPWeb mWeb = mSite.OpenWeb())  
    12.                     {  
    13.                         SPUser mSPUser = mWeb.AllUsers[LoginName];  
    14.                         if (mSPUser == null)  
    15.                         {  
    16.                             User = false;  
    17.                         }  
    18.   
    19.                         if (mSPUser.IsSiteAdmin == true)  
    20.                         {  
    21.                             Admin = true;  
    22.                         }  
    23.   
    24.                         User = true;  
    25.                         NickName = Convert.ToString(mSPUser.Name);  
    26.   
    27.                     }  
    28.                 }  
    29.             });  
    30.   
    31.             nickName = NickName;  
    32.             isAdmin = Admin;  
    33.             return User;  
    34.   
    35.         }  
    Regards,
     
    Ken 
  •  10-31-2010, 10:32 PM 64819 in reply to 64783

    Re: Prepopulate Messenger Contact list

    Hi Ken,
     
    Thanks
View as RSS news feed in XML