コード例 #1
0
        public async static Task <bool> UpdateListItem(string groupid, string siteId, string listId, string itemId, IDictionary <string, object> data)
        {
            _graphClient = GraphServiceClientProvider.GetAuthenticatedClient();

            var fieldValueSet = new FieldValueSet
            {
                AdditionalData = data,
            };

            try
            {
                await _graphClient.Groups[groupid]
                .Sites[siteId]
                .Lists[listId]
                .Items[itemId]
                .Fields
                .Request()
                .UpdateAsync(fieldValueSet);

                return(true);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                return(false);
            }
        }
コード例 #2
0
        public async static Task <List> GetSiteList(string groupId, string siteId, string listId)
        {
            _graphClient = GraphServiceClientProvider.GetAuthenticatedClient();
            List list = await _graphClient.Groups[groupId]
                        .Sites[siteId]
                        .Lists[listId].Request().GetAsync();

            return(list);
        }
コード例 #3
0
        public async static Task <ISiteListsCollectionPage> GetSiteLists(string groupId, string siteId)
        {
            _graphClient = GraphServiceClientProvider.GetAuthenticatedClient();
            ISiteListsCollectionPage lists = await _graphClient
                                             .Groups[groupId]
                                             .Sites[siteId]
                                             .Lists.Request().GetAsync();

            return(lists);
        }
コード例 #4
0
        public async static Task <IListItemsCollectionPage> GetSiteListItems(string groupId, string siteId, string listId)
        {
            _graphClient = GraphServiceClientProvider.GetAuthenticatedClient();
            IListItemsCollectionPage listItems = await _graphClient
                                                 .Groups[groupId]
                                                 .Sites[siteId]
                                                 .Lists[listId]
                                                 .Items
                                                 .Request().Expand("fields")
                                                 .GetAsync();

            return(listItems);
        }
コード例 #5
0
        static async Task Main(string[] args)
        {
            // Get an authenticated client
            _graphClient = GraphServiceClientProvider.GetAuthenticatedClient();

            // Get the logged-in user
            user = _graphClient.Me.Request().GetAsync().Result;

            // Get all the SharePoint Lists
            lists = await GetList();

            // Get the list of members from SharePoint
            await RetrieveListItemsFromSharePoint(_member);

            // Add the logged-in user to the SharePoint Lists (if they don't exist)
            await AddLoggedInUser();

            await RetrieveListItemsFromSharePoint(_officeItem);
            await RetrieveListItemsFromSharePoint(_officeBook);

            MenuSelection();
        }
コード例 #6
0
        public async static Task <bool> DeleteListItem(string groupid, string siteId, string listId, string itemId)
        {
            _graphClient = GraphServiceClientProvider.GetAuthenticatedClient();

            try
            {
                await _graphClient
                //.Groups[groupid]
                .Sites[siteId]
                .Lists[listId]
                .Items[itemId]
                .Request()
                .DeleteAsync();

                return(true);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                return(false);
            }
        }