Beispiel #1
0
        public void UserLogin(string username)
        {
            ws = new GroupWiseBinding();
            string str = "http://";

            str   += "10.20.136.206";
            str   += ":";
            str   += "7191";
            str   += "/soap";
            ws.Url = str;
            TrustedApplication trusted = new TrustedApplication();

            trusted.name = "ZimbraGWmigration";
            trusted.key  = admin.Key;//outkey.ToString();


            trusted.username = username;



            loginRequest reql = new loginRequest();

            reql.auth = trusted;

            loginResponse respl;

            try
            {
                respl = ws.loginRequest(reql);


                if (0 == respl.status.code)
                {
                    System.Console.WriteLine(" Login success ful");

                    ws.session         = new @string();
                    ws.session.Text    = new String[1];
                    ws.session.Text[0] = respl.session;


                    ws.Timeout = 300000;
                    string uid = respl.userinfo.uuid;

                    string sessioninfo = respl.session;

                    getContactFolders(uid, admin.Key);
                    //bLogin = false;
                    // getFolders(sessioninfo);
                }
            }
            catch (Exception e)
            {
                System.Console.WriteLine("Exception in Getuserlist : " + e.Message);
            }
        }
Beispiel #2
0
        protected void getContactFolders(string uid, string key)
        {
            String str;
            UserInfo User = new UserInfo();
            User.userid = "knuthi";

            ws = new GroupWiseBinding();
            str = "http://";
            str += "10.20.136.206";
            str += ":";
            str += "7191";
            str += "/soap";
            ws.Url = str;

            TrustedApplication trusted = new TrustedApplication();

            trusted.name = "ZimbraGWMigration";
            trusted.key = key;//outkey.ToString();

            trusted.username = "******";

            loginRequest reql = new loginRequest();
            reql.auth = trusted;

            loginResponse respl;
            respl = ws.loginRequest(reql);
            ws.session = new @string();
            ws.session.Text = new String[1];
            ws.session.Text[0] = respl.session;

            getFolderRequest req = new getFolderRequest();
            getFolderResponse resp;

            req.folderType = FolderType.Contacts;
            req.view = "";
            req.folderTypeSpecified = true;
            req.source = "folders";/*
            req.view = "";
            req.imap = false;
            req.nntp = false;*/

            resp = ws.getFolderRequest(req);
            if (0 == resp.status.code)
            {

                ws.session = new @string();
                ws.session.Text = new String[1];
                ws.session.Text[0] = respl.session;

                str = "Folders: ";
                if (null != resp.folder)
                {
                    // str += resp.folders.Length;

                    Folder f1 = (Folder)resp.folder;

                    string type = f1.name.ToString();

                    str += type;
                   System.Console.WriteLine(str);
                   string id = f1.id;
                   Dictionary<string, string> map = new Dictionary<string, string>();
                    getContactItems(id,map);
                    ws.session = new @string();
                    ws.session.Text = new String[1];
                    ws.session.Text[0] = respl.session;

                }

            }
            else
            {
                System.Console.WriteLine(resp.status.description);

            }
        }
Beispiel #3
0
        public void UserLogin(string username)
        {
            ws = new GroupWiseBinding();
            string str = "http://";
            str += "10.20.136.206";
            str += ":";
            str += "7191";
            str += "/soap";
            ws.Url = str;
            TrustedApplication trusted = new TrustedApplication();

            trusted.name = "ZimbraGWmigration";
            trusted.key = admin.Key;//outkey.ToString();

            trusted.username = username;

            loginRequest reql = new loginRequest();
            reql.auth = trusted;

            loginResponse respl;

            try
            {

                respl = ws.loginRequest(reql);

                if (0 == respl.status.code)
                {
                    System.Console.WriteLine(" Login success ful");

                    ws.session = new @string();
                    ws.session.Text = new String[1];
                    ws.session.Text[0] = respl.session;

                    ws.Timeout = 300000;
                    string uid = respl.userinfo.uuid;

                    string sessioninfo = respl.session;

                    getContactFolders(uid,admin.Key);
                    //bLogin = false;
                   // getFolders(sessioninfo);

                }

            }
            catch (Exception e)
            {
                System.Console.WriteLine("Exception in Getuserlist : " + e.Message);

            }
        }
Beispiel #4
0
        public void Login()
        {
            System.Net.ServicePointManager.Expect100Continue = false;

            loginRequest req = new loginRequest();
            loginResponse resp;
            PlainText pt = new PlainText();

            ws = new GroupWiseBinding();
            string str = "http://";
            str += "10.20.136.206";
            str += ":";
            str += "7191";
            str += "/soap";
            ws.Url = str;

            //    ws.Discover();

            ws.Timeout = 100000;
            //commenting out the following since we will have to use trusted connection thru the admin acoount.

               /* pt.username = "******";
            pt.password = "******";
            req.auth = pt;*/

            TrustedApplication trustedapp = new TrustedApplication();
            trustedapp.name = "ZimbraGWmigration";
            trustedapp.key = admin.Key;
            trustedapp.username = admin.Username;

            req.auth = trustedapp;

            try
            {

                resp = ws.loginRequest(req);
            }
            catch (Exception ex)
            {
                string message = ex.Message;
                ws.Discover();
                resp = ws.loginRequest(req);
            }

            string statusmessage = resp.status.code.ToString();
            if (0 == resp.status.code)
            {
                System.Console.WriteLine(" Login success ful");

                ws.session = new @string();
                ws.session.Text = new String[1];
                ws.session.Text[0] = resp.session;

                ws.Timeout = 300000;
                string uid = resp.userinfo.uuid;

               string sessioninfo = resp.session;
                //bLogin = false;
                //getFolders(sessioninfo);

            }
            else
            {
                System.Console.WriteLine(statusmessage);

            }
        }
Beispiel #5
0
        public void Login()
        {
            System.Net.ServicePointManager.Expect100Continue = false;

            loginRequest  req = new loginRequest();
            loginResponse resp;
            PlainText     pt = new PlainText();

            ws = new GroupWiseBinding();
            string str = "http://";

            str   += "10.20.136.206";
            str   += ":";
            str   += "7191";
            str   += "/soap";
            ws.Url = str;

            //    ws.Discover();

            ws.Timeout = 100000;
            //commenting out the following since we will have to use trusted connection thru the admin acoount.

            /* pt.username = "******";
             * pt.password = "******";
             * req.auth = pt;*/

            TrustedApplication trustedapp = new TrustedApplication();

            trustedapp.name     = "ZimbraGWmigration";
            trustedapp.key      = admin.Key;
            trustedapp.username = admin.Username;

            req.auth = trustedapp;



            try
            {
                resp = ws.loginRequest(req);
            }
            catch (Exception ex)
            {
                string message = ex.Message;
                ws.Discover();
                resp = ws.loginRequest(req);
            }

            string statusmessage = resp.status.code.ToString();

            if (0 == resp.status.code)
            {
                System.Console.WriteLine(" Login success ful");

                ws.session         = new @string();
                ws.session.Text    = new String[1];
                ws.session.Text[0] = resp.session;


                ws.Timeout = 300000;
                string uid = resp.userinfo.uuid;

                string sessioninfo = resp.session;
                //bLogin = false;
                //getFolders(sessioninfo);
            }
            else
            {
                System.Console.WriteLine(statusmessage);
            }
        }
Beispiel #6
0
        protected void getContactFolders(string uid, string key)
        {
            String   str;
            UserInfo User = new UserInfo();

            User.userid = "knuthi";

            ws     = new GroupWiseBinding();
            str    = "http://";
            str   += "10.20.136.206";
            str   += ":";
            str   += "7191";
            str   += "/soap";
            ws.Url = str;



            TrustedApplication trusted = new TrustedApplication();

            trusted.name = "ZimbraGWMigration";
            trusted.key  = key;//outkey.ToString();


            trusted.username = "******";



            loginRequest reql = new loginRequest();

            reql.auth = trusted;

            loginResponse respl;

            respl              = ws.loginRequest(reql);
            ws.session         = new @string();
            ws.session.Text    = new String[1];
            ws.session.Text[0] = respl.session;


            getFolderRequest  req = new getFolderRequest();
            getFolderResponse resp;



            req.folderType          = FolderType.Contacts;
            req.view                = "";
            req.folderTypeSpecified = true;
            req.source              = "folders";/*
                                                 * req.view = "";
                                                 * req.imap = false;
                                                 * req.nntp = false;*/


            resp = ws.getFolderRequest(req);
            if (0 == resp.status.code)
            {
                ws.session         = new @string();
                ws.session.Text    = new String[1];
                ws.session.Text[0] = respl.session;

                str = "Folders: ";
                if (null != resp.folder)
                {
                    // str += resp.folders.Length;

                    Folder f1 = (Folder)resp.folder;

                    string type = f1.name.ToString();

                    str += type;
                    System.Console.WriteLine(str);
                    string id = f1.id;
                    Dictionary <string, string> map = new Dictionary <string, string>();
                    getContactItems(id, map);
                    ws.session         = new @string();
                    ws.session.Text    = new String[1];
                    ws.session.Text[0] = respl.session;
                }
            }
            else
            {
                System.Console.WriteLine(resp.status.description);
            }
        }