コード例 #1
0
        public string CreateGroup(String name, String descriptioon, string ownerEmployeeId)
        {
            if (_service == null)
            {
                throw new Exception("Service is null. You need to login first!");
            }

            if (string.IsNullOrEmpty(name) || string.IsNullOrEmpty(ownerEmployeeId))
            {
                throw new Exception("Invalid argument!");
            }

            Salesforce.User user = GetUser(ownerEmployeeId);
            Salesforce.CollaborationGroup grp = new Salesforce.CollaborationGroup()
            {
                Name              = name,
                Description       = descriptioon,
                OwnerId           = user.Id,
                CollaborationType = "Private"
            };

            Salesforce.SaveResult[] results = _service.create(new Salesforce.sObject[] { grp });
            foreach (Salesforce.SaveResult result in results)
            {
                if (!result.success)
                {
                    throw new Exception(result.errors.Select(it => it.statusCode + ":" + it.message).Aggregate((s1, s2) => s1 + "\n" + s2));
                }
            }
            return(results[0].id);
        }
コード例 #2
0
        public void TestGetGroup()
        {
            IChatterSoapService service = new ChatterService.ChatterSoapService(_url);

            service.Login(_username, _password, _token);
            string id = "0F9Z000000007Zu";

            Salesforce.CollaborationGroup group = service.GetCollaborationGroup(id);
        }