/// <summary>
        /// Logins current binding.
        /// </summary>
        /// <param name="username">The username.</param>
        /// <param name="password">The password.</param>
        /// <param name="token">The token.</param>
        /// <param name="userInfo">The user info.</param>
        /// <returns>Login result.</returns>
        public bool Login(string username, string password, string token, out UserInfo userInfo)
        {
            if (!_loggedIn)
            {
                LoginResult loginResult = _binding.login(username, String.Concat(password, token));

                _binding.Url = loginResult.serverUrl;
                _binding.SessionHeaderValue = new SessionHeader
                {
                    sessionId = loginResult.sessionId
                };

                _salesforceGlobals = _binding.describeGlobal();

                _userInfo = new UserInfo
                {
                    UserSFID         = loginResult.userId,
                    OrganizationSFID = loginResult.userInfo.organizationId,
                    OrganizationName = loginResult.userInfo.organizationName
                };

                userInfo = _userInfo; _loggedIn = true;
            }
            else
            {
                userInfo = null;
            }

            return(_loggedIn);
        }
Example #2
0
        /// <summary>
        /// Returns a list of tables from salesforce
        /// </summary>
        /// <returns></returns>
        public List <string> GatTablesList()
        {
            sobjectsNames = new List <string>();
            DescribeGlobalResult dgr = binding.describeGlobal();

            for (int i = 0; i < dgr.sobjects.Length; i++)
            {
                sobjectsNames.Add(dgr.sobjects[i].name);
            }

            return(sobjectsNames);
        }
Example #3
0
        public List <string> GatTableNameList()
        {
            List <string>        sobjectsNames = new List <string>();
            DescribeGlobalResult dgr           = _binding.describeGlobal();

            foreach (var obj in dgr.sobjects)
            {
                sobjectsNames.Add(obj.name);
            }

            return(sobjectsNames);
        }
Example #4
0
        public List <string> GetTableNameList()
        {
            List <string>        sobjectsNames = new List <string>();
            DescribeGlobalResult dgr           = salesforceSoapService.describeGlobal();

            foreach (var obj in dgr.sobjects)
            {
                sobjectsNames.Add(obj.name);
            }

            return(sobjectsNames);
        }
Example #5
0
        /**
         * To determine the objects that are available to the logged-in
         * user, the sample client application executes a describeGlobal
         * call, which returns all of the objects that are visible to
         * the logged-in user. This call should not be made more than
         * once per session, as the data returned from the call likely
         * does not change frequently. The DescribeGlobalResult is
         * simply echoed to the console.
         */
        private void describeGlobalSample()
        {
            try
            {
                // describeGlobal() returns an array of object results that
                // includes the object names that are available to the logged-in user.
                DescribeGlobalResult dgr = binding.describeGlobal();

                Console.WriteLine("\nDescribe Global Results:\n");
                // Loop through the array echoing the object names to the console
                for (int i = 0; i < dgr.sobjects.Length; i++)
                {
                    Console.WriteLine(dgr.sobjects[i].name);
                }
            }
            catch (SoapException e)
            {
                Console.WriteLine("An exception has occurred: " + e.Message +
                                  "\nStack trace: " + e.StackTrace);
            }
        }
Example #6
0
        internal DescribeGlobalSObjectResult[] GetObjects()
        {
            DescribeGlobalResult describeGlobalResult = _sforceService.describeGlobal();

            return(describeGlobalResult.sobjects);
        }