コード例 #1
0
        public async Task GetRelatedPeopleASync(RelatedPeopleRequest request, OnGetRelatedPersonCompleted onGetRelatedPersonCompleted, OnGetRelatedPeopleCompleted onGetRelatedPeopleCompleted)
        {
            List <Person> persons = new List <Person>();

            var graphClient = AuthenticationHelper.Instance.GetAuthenticatedClient();

            string filter = "personType/class eq 'Person' and personType/subclass eq 'OrganizationUser'";

            if (graphClient != null)
            {
                if (request.person.Id == "")
                {
                    IUserPeopleCollectionPage people = await graphClient.Me.People.Request().Filter(filter).GetAsync();

                    persons.AddRange(people);
                }
                else
                {
                    try
                    {
                        IUserPeopleCollectionPage people = await graphClient.Users[request.person.Id].People.Request().Filter(filter).GetAsync();
                        persons.AddRange(people);
                    }
                    catch (Exception)
                    {
                    }
                }
            }

            foreach (Person person in persons)
            {
                switch (person.PersonType.Class)
                {
                case "Person":
                    PhotoDetail detail = await GetPhotoAsync(person.Id);

                    PersonEntity data = new PersonEntity()
                    {
                        FullName       = person.DisplayName,
                        Surname        = person.Surname,
                        GivenName      = person.GivenName,
                        JobTitle       = person.JobTitle,
                        Department     = person.Department,
                        OfficeLocation = person.OfficeLocation,
                        PhoneNumber    = person.Phones.Any() ? person.Phones.First().Number : "",
                        EmailAddress   = person.ScoredEmailAddresses.Any() ? person.ScoredEmailAddresses.First().Address : "",
                        Id             = person.Id,
                        PhotoDetail    = detail
                    };

                    request.relatedPerson = data;
                    onGetRelatedPersonCompleted(request);
                    request.relatedPeople.Add(data);
                    break;

                case "Group":
                    break;
                }
            }

            request.relatedPerson = null;
            onGetRelatedPeopleCompleted(request);
        }
コード例 #2
0
 public void GetRelatedPeople(RelatedPeopleRequest request, OnGetRelatedPersonCompleted onGetRelatedPersonCompleted, OnGetRelatedPeopleCompleted onGetRelatedPeopleCompleted)
 {
 }
コード例 #3
0
 public void GetRelatedPeople(RelatedPeopleRequest request, OnGetRelatedPersonCompleted onGetRelatedPersonCompleted, OnGetRelatedPeopleCompleted onGetRelatedPeopleCompleted)
 {
     System.Threading.Tasks.Task.Run(
         () => GetRelatedPeopleASync(request, onGetRelatedPersonCompleted, onGetRelatedPeopleCompleted));
 }