Я пытаюсь добавить пользователя в группу с помощью Azure GraphClient API 2.0 (2.0.5, последняя версия от 09.02.2015) и имею следующие исключения:
System.AggregateException: произошла одна или несколько ошибок. ---> System.Data.Services.Client.DataServiceRequestException: при обработке этого запроса произошла ошибка. ---> System.Data.Services.Client.DataServiceClientException: {"odata.error":{"code":"Request_BadRequest","message":{"lang":"en","value":"Набор изменений не может включать изменения более чем в 1 исходный ресурс."},"values":null}}
с фрагментом кода ниже :
IUser userToAdd = GetUserByObjectId('user_object_id');
Group groupToUpdate = GetGroupByObjectId('group_object_id') as Group;
if (userToAdd != null && groupToUpdate != null)
{
groupToUpdate.Members.Add(userToAdd as DirectoryObject);
groupToUpdate.UpdateAsync().Wait();
ОБНОВЛЕНИЕ (10.02.2015):
Я записал журнал трассировки Fiddler .
Последовательность запросов:
# Result Protocol Host URL Body Caching Content-Type Process Comments Custom
9 201 HTTPS graph.windows.net /%TENANT_ID%/groups?api-version=1.5 576 no-cache; Expires: -1 application/json;odata=minimalmetadata;streaming=true;charset=utf-8 w3wp:2280
10 200 HTTPS graph.windows.net /%TENANT_ID%/groups?api-version=1.5 13,242 no-cache; Expires: -1 application/json;odata=minimalmetadata;streaming=true;charset=utf-8 w3wp:2280
11 200 HTTPS graph.windows.net /%TENANT_ID%/groups/%GROUP_ID%?api-version=1.5 576 no-cache; Expires: -1 application/json;odata=minimalmetadata;streaming=true;charset=utf-8 w3wp:2280
12 200 HTTPS graph.windows.net /%TENANT_ID%/users/%USER_ID%?api-version=1.5 1,083 no-cache; Expires: -1 application/json;odata=minimalmetadata;streaming=true;charset=utf-8 w3wp:2280
13 400 HTTPS graph.windows.net /%TENANT_ID%/directoryObjects/%GROUP_ID%/Microsoft.DirectoryServices.Group/members?api-version=1.5 164 private application/json;odata=minimalmetadata;charset=utf-8 w3wp:2280
14 204 HTTPS graph.windows.net /%TENANT_ID%/directoryObjects/%GROUP_ID%/Microsoft.DirectoryServices.Group?api-version=1.5 0 no-cache; Expires: -1 w3wp:2280
Детали каждого запроса:
POST https://graph.windows.net/%TENANT_ID%/g ... ersion=1.5 HTTP/1.1
DataServiceVersion: 3.0;NetFx
MaxDataServiceVersion: 3.0;NetFx
Content-Type: application/json;odata=minimalmetadata
Accept: application/json;odata=minimalmetadata
Accept-Charset: UTF-8
DataServiceUrlConventions: KeyAsSegment
User-Agent: Microsoft ADO.NET Data Services
Authorization: %ACCESS_TOKEN%
X-ClientService-ClientTag: Office 365 API Tools 1.1.0612
Host: graph.windows.net
Content-Length: 191
Expect: 100-continue
{"odata.type":"Microsoft.DirectoryServices.Group","description":"test@%DOMAIN%","displayName":"TESTGROUP","mailEnabled":false,"mailNickname":"nickname","securityEnabled":true}
HTTP/1.1 201 Created
Cache-Control: no-cache
Pragma: no-cache
Content-Type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8
Expires: -1
Location: https://graph.windows.net/%TENANT_ID%/d ... ices.Group
Server: Microsoft-IIS/8.5
ocp-aad-diagnostics-server-name: %SOME_KEY_1%
request-id: 6a690e15-xxxx-xxxx-xxxx-35d52ebd5050
client-request-id: e537b83b-xxxx-xxxx-xxxx-bc80c5025c71
x-ms-gateway-rewrite: false
x-ms-dirapi-data-contract-version: 1.5
ocp-aad-session-key: %KEY%
X-Content-Type-Options: nosniff
DataServiceVersion: 3.0;
Strict-Transport-Security: max-age=31536000; includeSubDomains
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
X-Powered-By: ASP.NET
Date: Tue, 10 Feb 2015 22:19:31 GMT
Content-Length: 576
{"odata.metadata":"https://graph.windows.net/%TENANT_ID%/$ ... bled":true}
------------------------------------------------------------------
GET https://graph.windows.net/%TENANT_ID%/g ... ersion=1.5 HTTP/1.1
DataServiceVersion: 1.0;NetFx
MaxDataServiceVersion: 3.0;NetFx
Accept: application/json;odata=minimalmetadata
Accept-Charset: UTF-8
DataServiceUrlConventions: KeyAsSegment
User-Agent: Microsoft ADO.NET Data Services
Authorization: %ACCESS_TOKEN%
X-ClientService-ClientTag: Office 365 API Tools 1.1.0612
Host: graph.windows.net
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-Type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8
Expires: -1
Server: Microsoft-IIS/8.5
ocp-aad-diagnostics-server-name: %SOME_KEY_1%
request-id: d74a33fb-xxxx-xxxx-xxxx-43e3e5c5a35f
client-request-id: 1d53a420-xxxx-xxxx-xxxx-151596872026
x-ms-gateway-rewrite: false
x-ms-dirapi-data-contract-version: 1.5
ocp-aad-session-key: %KEY%
X-Content-Type-Options: nosniff
DataServiceVersion: 3.0;
Strict-Transport-Security: max-age=31536000; includeSubDomains
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
X-Powered-By: ASP.NET
Date: Tue, 10 Feb 2015 22:19:33 GMT
Content-Length: 13242
{"odata.metadata":"https://graph.windows.net/%TENANT_ID%/$ ... up","value":[{"odata.type":"Microsoft.DirectoryServices.Group","objectType":"Group","objectId":"%GROUP_ID%","deletionTimestamp":null,"description":"test@%DOMAIN%","dirSyncEnabled":null,"displayName":"TESTGROUP","lastDirSyncTime":null,"mail":null,"mailNickname":"%MAIL_NICKNAME%","mailEnabled":false,"onPremisesSecurityIdentifier":null,"provisioningErrors":[],"proxyAddresses":[],"securityEnabled":true},{"odata.type":"Microsoft.DirectoryServices.Group","objectType":"Group","objectId":"0c27bdbc-xxxx-xxxx-xxxx-66fd5f63d798","deletionTimestamp":null,"description":null,"dirSyncEnabled":true,"displayName":"ADSyncPasswordSet","lastDirSyncTime":"2014-12-19T03:38:25Z","mail":null,"mailNickname":"ADSyncPasswordSet","mailEnabled":false,"onPremisesSecurityIdentifier":"S-1-5-21-1993123774-3458547345-3703279742-xxxx","provisioningErrors":[],"proxyAddresses":[],"securityEnabled":true},{"odata.type":"Microsoft.DirectoryServices.Group","objectType":"Group","objectId":"0cc118be-xxxx-xxxx-xxxx-b624ae770d19","deletionTimestamp":null,"description":"DNS clients who are permitted to perform dynamic updates on behalf of some other clients (such as DHCP servers).","dirSyncEnabled":true,"displayName":"DnsUpdateProxy","lastDirSyncTime":"2014-12-19T03:38:25Z","mail":null,"mailNickname":"DnsUpdateProxy","mailEnabled":false,"onPremisesSecurityIdentifier":"S-1-5-21-1993123774-3458547345-3703279742-xxxx","provisioningErrors":[],"proxyAddresses":[],"securityEnabled":true},{"odata.type":"Microsoft.DirectoryServices.Group","objectType":"Group","objectId":"14072b09-xxxx-xxxx-xxxx-e537635d34c0","deletionTimestamp":null,"description":"DNS clients who are permitted to perform dynamic updates on behalf of some other clients (such as DHCP servers).","dirSyncEnabled":null,"displayName":"DnsUpdateProxy","lastDirSyncTime":null,"mail":null,"mailNickname":"DnsUpdateProxy","mailEnabled":false,"onPremisesSecurityIdentifier":"S-1-5-21-1619918607-3034894204-2710842436-xxxx","provisioningErrors":[],"proxyAddresses":[],"securityEnabled":true},{"odata.type":"Microsoft.DirectoryServices.Group","objectType":"Group","objectId":"19f93a9d-xxxx-xxxx-xxxx-b91ece8b24f9","deletionTimestamp":null,"description":null,"dirSyncEnabled":null,"displayName":"FIMSyncOperators","lastDirSyncTime":null,"mail":null,"mailNickname":"FIMSyncOperators","mailEnabled":false,"onPremisesSecurityIdentifier":"S-1-5-21-1619918607-3034894204-2710842436-xxxx","provisioningErrors":[],"proxyAddresses":[],"securityEnabled":true},{"odata.type":"Microsoft.DirectoryServices.Group","objectType":"Group","objectId":"1f75b1c0-xxxx-xxxx-xxxx-e550328f8973","deletionTimestamp":null,"description":"Members of this group can access WMI resources over management protocols (such as WS-Management via the Windows Remote Management service). This applies only to WMI namespaces that grant access to the user.","dirSyncEnabled":null,"displayName":"WinRMRemoteWMIUsers__","lastDirSyncTime":null,"mail":null,"mailNickname":"WinRMRemoteWMIUsers__","mailEnabled":false,"onPremisesSecurityIdentifier":"S-1-5-21-1619918607-3034894204-2710842436-xxxx","provisioningErrors":[],"proxyAddresses":[],"securityEnabled":true},{"odata.type":"Microsoft.DirectoryServices.Group","objectType":"Group","objectId":"413668fe-xxxx-xxxx-xxxx-a0ebcf476dfc","deletionTimestamp":null,"description":null,"dirSyncEnabled":true,"displayName":"ADSyncBrowse","lastDirSyncTime":"2014-12-19T03:38:25Z","mail":null,"mailNickname":"ADSyncBrowse","mailEnabled":false,"onPremisesSecurityIdentifier":"S-1-5-21-1993123774-3458547345-3703279742-1112","provisioningErrors":[],"proxyAddresses":[],"securityEnabled":true},{"odata.type":"Microsoft.DirectoryServices.Group","objectType":"Group","objectId":"4be872db-xxxx-xxxx-xxxx-2eb7079a44ed","deletionTimestamp":null,"description":null,"dirSyncEnabled":true,"displayName":"HelpLibraryUpdaters","lastDirSyncTime":"2014-12-19T03:38:25Z","mail":null,"mailNickname":"HelpLibraryUpdaters","mailEnabled":false,"onPremisesSecurityIdentifier":"S-1-5-21-1993123774-3458547345-3703279742-xxxx","provisioningErrors":[],"proxyAddresses":[],"securityEnabled":true},{"odata.type":"Microsoft.DirectoryServices.Group","objectType":"Group","objectId":"6cebb7a3-xxxx-xxxx-xxxx-f3cc66597c7f","deletionTimestamp":null,"description":"DNS Administrators Group","dirSyncEnabled":null,"displayName":"DnsAdmins","lastDirSyncTime":null,"mail":null,"mailNickname":"DnsAdmins","mailEnabled":false,"onPremisesSecurityIdentifier":"S-1-5-21-1619918607-3034894204-2710842436-xxxx","provisioningErrors":[],"proxyAddresses":[],"securityEnabled":true},{"odata.type":"Microsoft.DirectoryServices.Group","objectType":"Group","objectId":"6d5e8c74-xxxx-xxxx-xxxx-e74dad7e6fd9","deletionTimestamp":null,"description":"Members in the group have the required access and privileges to be assigned as the log on account for the associated instance of SQL Server Browser.","dirSyncEnabled":null,"displayName":"SQLServer2005SQLBrowserUser$%DOMAIN%","lastDirSyncTime":null,"mail":null,"mailNickname":"SQLServer2005SQLBrowserUser_%DOMAIN%","mailEnabled":false,"onPremisesSecurityIdentifier":"S-1-5-21-1619918607-3034894204-2710842436-xxxx","provisioningErrors":[],"proxyAddresses":[],"securityEnabled":true},{"odata.type":"Microsoft.DirectoryServices.Group","objectType":"Group","objectId":"6ff48cbf-xxxx-xxxx-xxxx-2be51fd0f1bb","deletionTimestamp":null,"description":null,"dirSyncEnabled":null,"displayName":"FIMSyncAdmins","lastDirSyncTime":null,"mail":null,"mailNickname":"FIMSyncAdmins","mailEnabled":false,"onPremisesSecurityIdentifier":"S-1-5-21-1619918607-3034894204-2710842436-xxxx","provisioningErrors":[],"proxyAddresses":[],"securityEnabled":true},{"odata.type":"Microsoft.DirectoryServices.Group","objectType":"Group","objectId":"8f19946b-xxxx-xxxx-xxxx-8fe4448340e8","deletionTimestamp":null,"description":"Members in the group have the required access and privileges to be assigned as the log on account for the associated instance of SQL Server Browser.","dirSyncEnabled":true,"displayName":"SQLServer2005SQLBrowserUser$","lastDirSyncTime":"2014-12-19T03:38:25Z","mail":null,"mailNickname":"SQLServer2005SQLBrowserUser","mailEnabled":false,"onPremisesSecurityIdentifier":"S-1-5-21-1993123774-3458547345-3703279742-xxxx","provisioningErrors":[],"proxyAddresses":[],"securityEnabled":true},{"odata.type":"Microsoft.DirectoryServices.Group","objectType":"Group","objectId":"9fa2e738-xxxx-xxxx-xxxx-009211a5a4db","deletionTimestamp":null,"description":"Members of this group can access WMI resources over management protocols (such as WS-Management via the Windows Remote Management service). T h i s a p p l i e s o n l y t o W M I n a m e s p a c e s t h a t g r a n t a c c e s s t o t h e u s e r . " , " d i r S y n c E n a b l e d " : t r u e , " d i s p l a y N a m e " : " W i n R M R e m o t e W M I U s e r s _ _ " , " l a s t D i r S y n c T i m e " : " 2 0 1 4 - 1 2 - 1 9 T 0 3 : 3 8 : 2 5 Z " , " m a i l " : n u l l , " m a i l N i c k n a m e " : " W i n R M R e m o t e W M I U s e r s _ _ " , " m a i l E n a b l e d " : f a l s e , " o n P r e m i s e s S e c u r i t y I d e n t i f i e r " : " S - 1 - 5 - 2 1 - 1 9 9 3 1 2 3 7 7 4 - 3 4 5 8 5 4 7 3 4 5 - 3 7 0 3 2 7 9 7 4 2 - x x x x " , " p r o v i s i o n i n g E r r o r s " : [ ] , " p r o x y A d d r e s s e s " : [ ] , " s e c u r i t y E n a b l e d " : t r u e } , { " o d a t a . t y p e " : " M i c r o s o f t . D i r e c t o r y S e r v i c e s . G r o u p " , " o b j e c t T y p e " : " G r o u p " , " o b j e c t I d " : " b 3 0 4 2 6 e 5 - x x x x - x x x x - x x x x - e 7 c 1 0 7 4 d 1 2 1 e " , " d e l e t i o n T i m e s t a m p " : n u l l , " d e s c r i p t i o n " : n u l l , " d i r S y n c E n a b l e d " : n u l l , " d i s p l a y N a m e " : " F I M S y n c B r o w s e " , " l a s t D i r S y n c T i m e " : n u l l , " m a i l " : n u l l , " m a i l N i c k n a m e " : " F I M S y n c B r o w s e " , " m a i l E n a b l e d " : f a l s e , " o n P r e m i s e s S e c u r i t y I d e n t i f i e r " : " S - 1 - 5 - 2 1 - 1 6 1 9 9 1 8 6 0 7 - 3 0 3 4 8 9 4 2 0 4 - 2 7 1 0 8 4 2 4 3 6 - x x x x " , " p r o v i s i o n i n g E r r o r s " : [ ] , " p r o x y A d d r e s s e s " : [ ] , " s e c u r i t y E n a b l e d " : t r u e } , { " o d a t a . t y p e " : " M i c r o s o f t . D i r e c t o r y S e r v i c e s . G r o u p " , " o b j e c t T y p e " : " G r o u p " , " o b j e c t I d " : " b 3 5 1 b d 7 f - x x x x - x x x x - x x x x - d 7 c c 9 1 8 5 2 9 4 1 " , " d e l e t i o n T i m e s t a m p " : n u l l , " d e s c r i p t i o n " : n u l l , " d i r S y n c E n a b l e d " : n u l l , " d i s p l a y N a m e " : " F I M S y n c P a s s w o r d S e t " , " l a s t D i r S y n c T i m e " : n u l l , " m a i l " : n u l l , " m a i l N i c k n a m e " : " F I M S y n c P a s s w o r d S e t " , " m a i l E n a b l e d " : f a l s e , " o n P r e m i s e s S e c u r i t y I d e n t i f i e r " : " S - 1 - 5 - 2 1 - 1 6 1 9 9 1 8 6 0 7 - 3 0 3 4 8 9 4 2 0 4 - 2 7 1 0 8 4 2 4 3 6 - x x x x " , " p r o v i s i o n i n g E r r o r s " : [ ] , " p r o x y A d d r e s s e s " : [ ] , " s e c u r i t y E n a b l e d " : t r u e } , { " o d a t a . t y p e " : " M i c r o s o f t . D i r e c t o r y S e r v i c e s . G r o u p " , " o b j e c t T y p e " : " G r o u p " , " o b j e c t I d " : " b 8 c 3 e 5 9 0 - x x x x - x x x x - x x x x - 8 2 c 3 a d 1 5 0 d 7 9 " , " d e l e t i o n T i m e s t a m p " : n u l l , " d e s c r i p t i o n " : " M e m b e r s i n t h e g r o u p h a v e t h e r e q u i r e d a c c e s s a n d p r i v i l e g e s t o b e a s s i g n e d a s t h e l o g o n a c c o u n t f o r t h e a s s o c i a t e d i n s t a n c e o f S Q L S e r v e r A c t i v e D i r e c t o r y H e l p e r i n S Q L S e r v e r 2 0 0 8 . " , "dirSyncEnabled":true,"displayName":"SQLServerMSSQLServerADHelperUser","lastDirSyncTime":"2014-12-19T03:38:25Z","mail":null,"mailNickname":"SQLServerMSSQLServerADHelperUser","mailEnabled":false,"onPremisesSecurityIdentifier":"S-1-5-21-1993123774-3458547345-3703279742-xxxx","provisioningErrors":[],"proxyAddresses":[],"securityEnabled":true},{"odata.type":"Microsoft.DirectoryServices.Group","objectType":"Group","objectId":"ba74d1e1-xxxx-xxxx-xxxx-ba7733c5f248","deletionTimestamp":null,"description":null,"dirSyncEnabled":null,"displayName":"FIMSyncJoiners","lastDirSyncTime":null,"mail":null,"mailNickname":"FIMSyncJoiners","mailEnabled":false,"onPremisesSecurityIdentifier":"S-1-5-21-1619918607-3034894204-2710842436-xxxx","provisioningErrors":[],"proxyAddresses":[],"securityEnabled":true},{"odata.type":"Microsoft.DirectoryServices.Group","objectType":"Group","objectId":"c302433d-fa52-40fc-97bb-d4b17331db77","deletionTimestamp":null,"description":"Administrators for %DOMAIN%","dirSyncEnabled":null,"displayName":"%DOMAIN% Administrators","lastDirSyncTime":null,"mail":null,"mailNickname":"d9026cd3-xxxx-xxxx-xxxx-f1b90bf7935c","mailEnabled":false,"onPremisesSecurityIdentifier":null,"provisioningErrors":[],"proxyAddresses":[],"securityEnabled":true},{"odata.type":"Microsoft.DirectoryServices.Group","objectType":"Group","objectId":"c657ef3c-xxxx-xxxx-xxxx-b9f48cf659da","deletionTimestamp":null,"description":"DNS Administrators Group","dirSyncEnabled":true,"displayName":"DnsAdmins","lastDirSyncTime":"2014-12-19T03:38:25Z","mail":null,"mailNickname":"DnsAdmins","mailEnabled":false,"onPremisesSecurityIdentifier":"S-1-5-21-1993123774-3458547345-3703279742-xxxx","provisioningErrors":[],"proxyAddresses":[],"securityEnabled":true},{"odata.type":"Microsoft.DirectoryServices.Group","objectType":"Group","objectId":"cc4ec8c6-xxxx-xxxx-xxxx-ab5a1b2ea5f3","deletionTimestamp":null,"description":null,"dirSyncEnabled":null,"displayName":"Administrators","lastDirSyncTime":null,"mail":null,"mailNickname":"BposMailNickName","mailEnabled":false,"onPremisesSecurityIdentifier":null,"provisioningErrors":[],"proxyAddresses":[],"securityEnabled":true},{"odata.type":"Microsoft.DirectoryServices.Group","objectType":"Group","objectId":"cda3c0e8-xxxx-xxxx-xxxx-964323393fe0","deletionTimestamp":null,"description":"Members in the group have the required access and privileges to be assigned as the log on account for the associated instance of SQL Server Agent.","dirSyncEnabled":true,"displayName":"SQLServerSQLAgentUser$SQLEXPRESS","lastDirSyncTime":"2014-12-19T03:38:25Z","mail":null,"mailNickname":"SQLServerSQLAgentUser_SQLEXPRESS","mailEnabled":false,"onPremisesSecurityIdentifier":"S-1-5-21-1993123774-3458547345-3703279742-xxxx","provisioningErrors":[],"proxyAddresses":[],"securityEnabled":true},{"odata.type":"Microsoft.DirectoryServices.Group","objectType":"Group","objectId":"e29d60e1-xxxx-xxxx-xxxx-c4c553ae802c","deletionTimestamp":null,"description":null,"dirSyncEnabled":true,"displayName":"ADSyncAdmins","lastDirSyncTime":"2014-12-19T03:38:25Z","mail":null,"mailNickname":"ADSyncAdmins","mailEnabled":false,"onPremisesSecurityIdentifier":"S-1-5-21-1993123774-3458547345-3703279742-xxxx","provisioningErrors":[],"proxyAddresses":[],"securityEnabled":true},{"odata.type":"Microsoft.DirectoryServices.Group","objectType":"Group","objectId":"e69fa9da-a214-4e32-a1f3-8064e3413ffa","deletionTimestamp":null,"description":null,"dirSyncEnabled":true,"displayName":"ADSyncOperators","lastDirSyncTime":"2014-12-19T03:38:25Z","mail":null,"mailNickname":"ADSyncOperators","mailEnabled":false,"onPremisesSecurityIdentifier":"S-1-5-21-1993123774-3458547345-3703279742-xxxx","provisioningErrors":[],"proxyAddresses":[],"securityEnabled":true},{"odata.type":"Microsoft.DirectoryServices.Group","objectType":"Group","objectId":"eca4dcea-xxxx-xxxx-xxxx-5bfdb52cc127","deletionTimestamp":null,"description":"Members in the group have the required access and privileges to be assigned as the login account for the specified instance of SQL Server.","dirSyncEnabled":true,"displayName":"SQLServerMSSQLUser$SQLEXPRESS","lastDirSyncTime":"2014-12-19T03:38:25Z","mail":null,"mailNickname":"SQLServerMSSQLUser_SQLEXPRESS","mailEnabled":false,"onPremisesSecurityIdentifier":"S-1-5-21-1993123774-3458547345-3703279742-xxxx","provisioningErrors":[],"proxyAddresses":[],"securityEnabled":true},{"odata.type":"Microsoft.DirectoryServices.Group","objectType":"Group","objectId":"f509a5a9-xxxx-xxxx-xxxx-eb6e6c4d1883","deletionTimestamp":null,"description":"demo","dirSyncEnabled":null,"displayName":"demo","lastDirSyncTime":null,"mail":null,"mailNickname":"b5ecf2f6-xxxx-xxxx-xxxx-0056132ccac4","mailEnabled":false,"onPremisesSecurityIdentifier":null,"provisioningErrors":[],"proxyAddresses":[],"securityEnabled":true}]}
------------------------------------------------------------------
GET https://graph.windows.net/%TENANT_ID%/g ... ersion=1.5 HTTP/1.1
DataServiceVersion: 1.0;NetFx
MaxDataServiceVersion: 3.0;NetFx
Accept: application/json;odata=minimalmetadata
Accept-Charset: UTF-8
DataServiceUrlConventions: KeyAsSegment
User-Agent: Microsoft ADO.NET Data Services
Authorization: %ACCESS_TOKEN%
X-ClientService-ClientTag: Office 365 API Tools 1.1.0612
Host: graph.windows.net
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-Type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8
Expires: -1
Server: Microsoft-IIS/8.5
ocp-aad-diagnostics-server-name: %SOME_KEY_2%
request-id: 1ae63825-xxxx-xxxx-xxxx-10135628a629
client-request-id: 6c971ab8-xxxx-xxxx-xxxx-4a794cdf8fb9
x-ms-gateway-rewrite: false
x-ms-dirapi-data-contract-version: 1.5
ocp-aad-session-key: %KEY%
X-Content-Type-Options: nosniff
DataServiceVersion: 3.0;
Strict-Transport-Security: max-age=31536000; includeSubDomains
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
X-Powered-By: ASP.NET
Date: Tue, 10 Feb 2015 22:19:34 GMT
Content-Length: 576
{"odata.metadata":"https://graph.windows.net/%TENANT_ID%/$ ... bled":true}
------------------------------------------------------------------
GET https://graph.windows.net/%TENANT_ID%/u ... ersion=1.5 HTTP/1.1
DataServiceVersion: 1.0;NetFx
MaxDataServiceVersion: 3.0;NetFx
Accept: application/json;odata=minimalmetadata
Accept-Charset: UTF-8
DataServiceUrlConventions: KeyAsSegment
User-Agent: Microsoft ADO.NET Data Services
Authorization: %ACCESS_TOKEN%
X-ClientService-ClientTag: Office 365 API Tools 1.1.0612
Host: graph.windows.net
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-Type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8
Expires: -1
Server: Microsoft-IIS/8.5
ocp-aad-diagnostics-server-name: %SOME_KEY_1%
request-id: 99314ed2-xxxx-xxxx-xxxx-ee71fd4ffbfe
client-request-id: d6b9b8a2-xxxx-xxxx-xxxx-98ec20e65198
x-ms-gateway-rewrite: false
x-ms-dirapi-data-contract-version: 1.5
ocp-aad-session-key: %KEY%
X-Content-Type-Options: nosniff
DataServiceVersion: 3.0;
Strict-Transport-Security: max-age=31536000; includeSubDomains
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
X-Powered-By: ASP.NET
Date: Tue, 10 Feb 2015 22:19:34 GMT
Content-Length: 1083
{"odata.metadata":"https://graph.windows.net/%TENANT_ID%/$ ... ame":"John Smith","facsimileTelephoneNumber":null,"givenName":"John","immutableId":null,"jobTitle":null,"lastDirSyncTime":null,"mail":null,"mailNickname":"%DOMAIN%ONMICROSOFT","mobile":null,"onPremisesSecurityIdentifier":null,"otherMails":["jsmith@%DOMAIN%"],"passwordPolicies":null,"passwordProfile":null,"physicalDeliveryOfficeName":null,"postalCode":null,"preferredLanguage":"en-us","provisionedPlans":[],"provisioningErrors":[],"proxyAddresses":[],"sipProxyAddress":null,"state":null,"streetAddress":null,"surname":"Smith","telephoneNumber":null,"usageLocation":"US","userPrincipalName":"jsmith@%DOMAIN%.onmicrosoft.com","userType":"Member"}
------------------------------------------------------------------
POST https://graph.windows.net/%TENANT_ID%/d ... ersion=1.5 HTTP/1.1
DataServiceVersion: 3.0;NetFx
MaxDataServiceVersion: 3.0;NetFx
Content-Type: application/json;odata=minimalmetadata
Accept: application/json;odata=minimalmetadata
Accept-Charset: UTF-8
DataServiceUrlConventions: KeyAsSegment
User-Agent: Microsoft ADO.NET Data Services
Authorization: %ACCESS_TOKEN%
X-ClientService-ClientTag: Office 365 API Tools 1.1.0612
Host: graph.windows.net
Content-Length: 49
Expect: 100-continue
{"odata.type":"Microsoft.DirectoryServices.User"}
HTTP/1.1 400 Bad Request
Cache-Control: private
Content-Type: application/json;odata=minimalmetadata;charset=utf-8
Server: Microsoft-IIS/8.5
ocp-aad-diagnostics-server-name: %SOME_KEY_1%
request-id: 856504e9-xxxx-xxxx-xxxx-5bd2e6c64d44
client-request-id: a4ce7205-xxxx-xxxx-xxxx-77fad62c00f7
x-ms-gateway-rewrite: false
x-ms-dirapi-data-contract-version: 1.5
ocp-aad-session-key: %KEY%
Strict-Transport-Security: max-age=31536000; includeSubDomains
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
X-Powered-By: ASP.NET
Date: Tue, 10 Feb 2015 22:19:34 GMT
Content-Length: 164
{"odata.error":{"code":"Request_BadRequest","message":{"lang":"en","value":"A change set cannot include changes to more than '1' source resources."},"values":null}}
------------------------------------------------------------------
MERGE https://graph.windows.net/%TENANT_ID%/d ... ersion=1.5 HTTP/1.1
DataServiceVersion: 3.0;NetFx
MaxDataServiceVersion: 3.0;NetFx
Content-Type: application/json;odata=minimalmetadata
Accept: application/json;odata=minimalmetadata
Accept-Charset: UTF-8
DataServiceUrlConventions: KeyAsSegment
User-Agent: Microsoft ADO.NET Data Services
Authorization: %ACCESS_TOKEN%
X-ClientService-ClientTag: Office 365 API Tools 1.1.0612
Host: graph.windows.net
Content-Length: 50
Expect: 100-continue
{"odata.type":"Microsoft.DirectoryServices.Group"}
HTTP/1.1 204 No Content
Cache-Control: no-cache
Pragma: no-cache
Expires: -1
Server: Microsoft-IIS/8.5
ocp-aad-diagnostics-server-name: %SOME_KEY_2%
request-id: f05a4c03-xxxx-xxxx-xxxx-fc245fd03452
client-request-id: f3627ada-xxxx-xxxx-xxxx-6c54958c5613
x-ms-gateway-rewrite: false
x-ms-dirapi-data-contract-version: 1.5
ocp-aad-session-key: %KEY%
X-Content-Type-Options: nosniff
DataServiceVersion: 1.0;
Strict-Transport-Security: max-age=31536000; includeSubDomains
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
X-Powered-By: ASP.NET
Date: Tue, 10 Feb 2015 22:19:35 GMT
------------------------------------------------------------------
ОБНОВЛЕНИЕ (15 февраля 2015 г.)
Дополнительный код:
private async Task AcquireToken()
{
if (String.IsNullOrEmpty(AccessToken))
{
throw new Exception("Authorization is Required.");
}
else
{
return AccessToken;
}
}
private ActiveDirectoryClient GetActiveDirectoryClient()
{
Uri baseServiceUri = new Uri('https://graph.windows.net');
ActiveDirectoryClient activeDirectoryClient = new ActiveDirectoryClient(new Uri(baseServiceUri , 'tenant_id'), async () => { return AccessToken; });
return activeDirectoryClient;
}
private IUser GetUserByObjectId(String objectId)
{
try
{
ActiveDirectoryClient client = GetActiveDirectoryClient();
return client.Users.GetByObjectId(objectId).ExecuteAsync().Result;
}
catch (Exception ex)
{
//handling exceptions
}
}
private IGroup GetGroupByObjectId(String objectId)
{
try
{
ActiveDirectoryClient client = GetActiveDirectoryClient();
return client.Groups.GetByObjectId(objectId).ExecuteAsync().Result;
}
catch (Exception ex)
{
//handling exceptions
}
}
Подробнее здесь: https://stackoverflow.com/questions/284 ... urces-when
C#: «Набор изменений не может включать изменения более чем в 1 исходный ресурс» при добавлении пользователя в группу с п ⇐ C#
Место общения программистов C#
1727959614
Anonymous
Я пытаюсь добавить пользователя в группу с помощью Azure GraphClient API 2.0 (2.0.5, последняя версия от 09.02.2015) и имею следующие исключения:
System.AggregateException: произошла одна или несколько ошибок. ---> System.Data.Services.Client.DataServiceRequestException: при обработке этого запроса произошла ошибка. ---> System.Data.Services.Client.DataServiceClientException: {"odata.error":{"code":"Request_BadRequest","message":{"lang":"en","value":"[b]Набор изменений не может включать изменения более чем в 1 исходный ресурс.[/b]"},"values":null}}
с фрагментом кода ниже :
IUser userToAdd = GetUserByObjectId('user_object_id');
Group groupToUpdate = GetGroupByObjectId('group_object_id') as Group;
if (userToAdd != null && groupToUpdate != null)
{
groupToUpdate.Members.Add(userToAdd as DirectoryObject);
groupToUpdate.UpdateAsync().Wait();
[b]ОБНОВЛЕНИЕ (10.02.2015):[/b]
Я записал журнал трассировки Fiddler .
Последовательность запросов:
# Result Protocol Host URL Body Caching Content-Type Process Comments Custom
9 201 HTTPS graph.windows.net /%TENANT_ID%/groups?api-version=1.5 576 no-cache; Expires: -1 application/json;odata=minimalmetadata;streaming=true;charset=utf-8 w3wp:2280
10 200 HTTPS graph.windows.net /%TENANT_ID%/groups?api-version=1.5 13,242 no-cache; Expires: -1 application/json;odata=minimalmetadata;streaming=true;charset=utf-8 w3wp:2280
11 200 HTTPS graph.windows.net /%TENANT_ID%/groups/%GROUP_ID%?api-version=1.5 576 no-cache; Expires: -1 application/json;odata=minimalmetadata;streaming=true;charset=utf-8 w3wp:2280
12 200 HTTPS graph.windows.net /%TENANT_ID%/users/%USER_ID%?api-version=1.5 1,083 no-cache; Expires: -1 application/json;odata=minimalmetadata;streaming=true;charset=utf-8 w3wp:2280
13 400 HTTPS graph.windows.net /%TENANT_ID%/directoryObjects/%GROUP_ID%/Microsoft.DirectoryServices.Group/members?api-version=1.5 164 private application/json;odata=minimalmetadata;charset=utf-8 w3wp:2280
14 204 HTTPS graph.windows.net /%TENANT_ID%/directoryObjects/%GROUP_ID%/Microsoft.DirectoryServices.Group?api-version=1.5 0 no-cache; Expires: -1 w3wp:2280
Детали каждого запроса:
POST https://graph.windows.net/%TENANT_ID%/groups?api-version=1.5 HTTP/1.1
DataServiceVersion: 3.0;NetFx
MaxDataServiceVersion: 3.0;NetFx
Content-Type: application/json;odata=minimalmetadata
Accept: application/json;odata=minimalmetadata
Accept-Charset: UTF-8
DataServiceUrlConventions: KeyAsSegment
User-Agent: Microsoft ADO.NET Data Services
Authorization: %ACCESS_TOKEN%
X-ClientService-ClientTag: Office 365 API Tools 1.1.0612
Host: graph.windows.net
Content-Length: 191
Expect: 100-continue
{"odata.type":"Microsoft.DirectoryServices.Group","description":"test@%DOMAIN%","displayName":"TESTGROUP","mailEnabled":false,"mailNickname":"nickname","securityEnabled":true}
HTTP/1.1 201 Created
Cache-Control: no-cache
Pragma: no-cache
Content-Type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8
Expires: -1
Location: https://graph.windows.net/%TENANT_ID%/directoryObjects/%GROUP_ID%/Microsoft.DirectoryServices.Group
Server: Microsoft-IIS/8.5
ocp-aad-diagnostics-server-name: %SOME_KEY_1%
request-id: 6a690e15-xxxx-xxxx-xxxx-35d52ebd5050
client-request-id: e537b83b-xxxx-xxxx-xxxx-bc80c5025c71
x-ms-gateway-rewrite: false
x-ms-dirapi-data-contract-version: 1.5
ocp-aad-session-key: %KEY%
X-Content-Type-Options: nosniff
DataServiceVersion: 3.0;
Strict-Transport-Security: max-age=31536000; includeSubDomains
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
X-Powered-By: ASP.NET
Date: Tue, 10 Feb 2015 22:19:31 GMT
Content-Length: 576
{"odata.metadata":"https://graph.windows.net/%TENANT_ID%/$metadata#directoryObjects/Microsoft.DirectoryServices.Group/@Element","odata.type":"Microsoft.DirectoryServices.Group","objectType":"Group","objectId":"%GROUP_ID%","deletionTimestamp":null,"description":"test@%DOMAIN%","dirSyncEnabled":null,"displayName":"TESTGROUP","lastDirSyncTime":null,"mail":null,"mailNickname":"%MAIL_NICKNAME%","mailEnabled":false,"onPremisesSecurityIdentifier":null,"provisioningErrors":[],"proxyAddresses":[],"securityEnabled":true}
------------------------------------------------------------------
GET https://graph.windows.net/%TENANT_ID%/groups?api-version=1.5 HTTP/1.1
DataServiceVersion: 1.0;NetFx
MaxDataServiceVersion: 3.0;NetFx
Accept: application/json;odata=minimalmetadata
Accept-Charset: UTF-8
DataServiceUrlConventions: KeyAsSegment
User-Agent: Microsoft ADO.NET Data Services
Authorization: %ACCESS_TOKEN%
X-ClientService-ClientTag: Office 365 API Tools 1.1.0612
Host: graph.windows.net
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-Type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8
Expires: -1
Server: Microsoft-IIS/8.5
ocp-aad-diagnostics-server-name: %SOME_KEY_1%
request-id: d74a33fb-xxxx-xxxx-xxxx-43e3e5c5a35f
client-request-id: 1d53a420-xxxx-xxxx-xxxx-151596872026
x-ms-gateway-rewrite: false
x-ms-dirapi-data-contract-version: 1.5
ocp-aad-session-key: %KEY%
X-Content-Type-Options: nosniff
DataServiceVersion: 3.0;
Strict-Transport-Security: max-age=31536000; includeSubDomains
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
X-Powered-By: ASP.NET
Date: Tue, 10 Feb 2015 22:19:33 GMT
Content-Length: 13242
{"odata.metadata":"https://graph.windows.net/%TENANT_ID%/$metadata#directoryObjects/Microsoft.DirectoryServices.Group","value":[{"odata.type":"Microsoft.DirectoryServices.Group","objectType":"Group","objectId":"%GROUP_ID%","deletionTimestamp":null,"description":"test@%DOMAIN%","dirSyncEnabled":null,"displayName":"TESTGROUP","lastDirSyncTime":null,"mail":null,"mailNickname":"%MAIL_NICKNAME%","mailEnabled":false,"onPremisesSecurityIdentifier":null,"provisioningErrors":[],"proxyAddresses":[],"securityEnabled":true},{"odata.type":"Microsoft.DirectoryServices.Group","objectType":"Group","objectId":"0c27bdbc-xxxx-xxxx-xxxx-66fd5f63d798","deletionTimestamp":null,"description":null,"dirSyncEnabled":true,"displayName":"ADSyncPasswordSet","lastDirSyncTime":"2014-12-19T03:38:25Z","mail":null,"mailNickname":"ADSyncPasswordSet","mailEnabled":false,"onPremisesSecurityIdentifier":"S-1-5-21-1993123774-3458547345-3703279742-xxxx","provisioningErrors":[],"proxyAddresses":[],"securityEnabled":true},{"odata.type":"Microsoft.DirectoryServices.Group","objectType":"Group","objectId":"0cc118be-xxxx-xxxx-xxxx-b624ae770d19","deletionTimestamp":null,"description":"DNS clients who are permitted to perform dynamic updates on behalf of some other clients (such as DHCP servers).","dirSyncEnabled":true,"displayName":"DnsUpdateProxy","lastDirSyncTime":"2014-12-19T03:38:25Z","mail":null,"mailNickname":"DnsUpdateProxy","mailEnabled":false,"onPremisesSecurityIdentifier":"S-1-5-21-1993123774-3458547345-3703279742-xxxx","provisioningErrors":[],"proxyAddresses":[],"securityEnabled":true},{"odata.type":"Microsoft.DirectoryServices.Group","objectType":"Group","objectId":"14072b09-xxxx-xxxx-xxxx-e537635d34c0","deletionTimestamp":null,"description":"DNS clients who are permitted to perform dynamic updates on behalf of some other clients (such as DHCP servers).","dirSyncEnabled":null,"displayName":"DnsUpdateProxy","lastDirSyncTime":null,"mail":null,"mailNickname":"DnsUpdateProxy","mailEnabled":false,"onPremisesSecurityIdentifier":"S-1-5-21-1619918607-3034894204-2710842436-xxxx","provisioningErrors":[],"proxyAddresses":[],"securityEnabled":true},{"odata.type":"Microsoft.DirectoryServices.Group","objectType":"Group","objectId":"19f93a9d-xxxx-xxxx-xxxx-b91ece8b24f9","deletionTimestamp":null,"description":null,"dirSyncEnabled":null,"displayName":"FIMSyncOperators","lastDirSyncTime":null,"mail":null,"mailNickname":"FIMSyncOperators","mailEnabled":false,"onPremisesSecurityIdentifier":"S-1-5-21-1619918607-3034894204-2710842436-xxxx","provisioningErrors":[],"proxyAddresses":[],"securityEnabled":true},{"odata.type":"Microsoft.DirectoryServices.Group","objectType":"Group","objectId":"1f75b1c0-xxxx-xxxx-xxxx-e550328f8973","deletionTimestamp":null,"description":"Members of this group can access WMI resources over management protocols (such as WS-Management via the Windows Remote Management service). This applies only to WMI namespaces that grant access to the user.","dirSyncEnabled":null,"displayName":"WinRMRemoteWMIUsers__","lastDirSyncTime":null,"mail":null,"mailNickname":"WinRMRemoteWMIUsers__","mailEnabled":false,"onPremisesSecurityIdentifier":"S-1-5-21-1619918607-3034894204-2710842436-xxxx","provisioningErrors":[],"proxyAddresses":[],"securityEnabled":true},{"odata.type":"Microsoft.DirectoryServices.Group","objectType":"Group","objectId":"413668fe-xxxx-xxxx-xxxx-a0ebcf476dfc","deletionTimestamp":null,"description":null,"dirSyncEnabled":true,"displayName":"ADSyncBrowse","lastDirSyncTime":"2014-12-19T03:38:25Z","mail":null,"mailNickname":"ADSyncBrowse","mailEnabled":false,"onPremisesSecurityIdentifier":"S-1-5-21-1993123774-3458547345-3703279742-1112","provisioningErrors":[],"proxyAddresses":[],"securityEnabled":true},{"odata.type":"Microsoft.DirectoryServices.Group","objectType":"Group","objectId":"4be872db-xxxx-xxxx-xxxx-2eb7079a44ed","deletionTimestamp":null,"description":null,"dirSyncEnabled":true,"displayName":"HelpLibraryUpdaters","lastDirSyncTime":"2014-12-19T03:38:25Z","mail":null,"mailNickname":"HelpLibraryUpdaters","mailEnabled":false,"onPremisesSecurityIdentifier":"S-1-5-21-1993123774-3458547345-3703279742-xxxx","provisioningErrors":[],"proxyAddresses":[],"securityEnabled":true},{"odata.type":"Microsoft.DirectoryServices.Group","objectType":"Group","objectId":"6cebb7a3-xxxx-xxxx-xxxx-f3cc66597c7f","deletionTimestamp":null,"description":"DNS Administrators Group","dirSyncEnabled":null,"displayName":"DnsAdmins","lastDirSyncTime":null,"mail":null,"mailNickname":"DnsAdmins","mailEnabled":false,"onPremisesSecurityIdentifier":"S-1-5-21-1619918607-3034894204-2710842436-xxxx","provisioningErrors":[],"proxyAddresses":[],"securityEnabled":true},{"odata.type":"Microsoft.DirectoryServices.Group","objectType":"Group","objectId":"6d5e8c74-xxxx-xxxx-xxxx-e74dad7e6fd9","deletionTimestamp":null,"description":"Members in the group have the required access and privileges to be assigned as the log on account for the associated instance of SQL Server Browser.","dirSyncEnabled":null,"displayName":"SQLServer2005SQLBrowserUser$%DOMAIN%","lastDirSyncTime":null,"mail":null,"mailNickname":"SQLServer2005SQLBrowserUser_%DOMAIN%","mailEnabled":false,"onPremisesSecurityIdentifier":"S-1-5-21-1619918607-3034894204-2710842436-xxxx","provisioningErrors":[],"proxyAddresses":[],"securityEnabled":true},{"odata.type":"Microsoft.DirectoryServices.Group","objectType":"Group","objectId":"6ff48cbf-xxxx-xxxx-xxxx-2be51fd0f1bb","deletionTimestamp":null,"description":null,"dirSyncEnabled":null,"displayName":"FIMSyncAdmins","lastDirSyncTime":null,"mail":null,"mailNickname":"FIMSyncAdmins","mailEnabled":false,"onPremisesSecurityIdentifier":"S-1-5-21-1619918607-3034894204-2710842436-xxxx","provisioningErrors":[],"proxyAddresses":[],"securityEnabled":true},{"odata.type":"Microsoft.DirectoryServices.Group","objectType":"Group","objectId":"8f19946b-xxxx-xxxx-xxxx-8fe4448340e8","deletionTimestamp":null,"description":"Members in the group have the required access and privileges to be assigned as the log on account for the associated instance of SQL Server Browser.","dirSyncEnabled":true,"displayName":"SQLServer2005SQLBrowserUser$","lastDirSyncTime":"2014-12-19T03:38:25Z","mail":null,"mailNickname":"SQLServer2005SQLBrowserUser","mailEnabled":false,"onPremisesSecurityIdentifier":"S-1-5-21-1993123774-3458547345-3703279742-xxxx","provisioningErrors":[],"proxyAddresses":[],"securityEnabled":true},{"odata.type":"Microsoft.DirectoryServices.Group","objectType":"Group","objectId":"9fa2e738-xxxx-xxxx-xxxx-009211a5a4db","deletionTimestamp":null,"description":"Members of this group can access WMI resources over management protocols (such as WS-Management via the Windows Remote Management service). T h i s a p p l i e s o n l y t o W M I n a m e s p a c e s t h a t g r a n t a c c e s s t o t h e u s e r . " , " d i r S y n c E n a b l e d " : t r u e , " d i s p l a y N a m e " : " W i n R M R e m o t e W M I U s e r s _ _ " , " l a s t D i r S y n c T i m e " : " 2 0 1 4 - 1 2 - 1 9 T 0 3 : 3 8 : 2 5 Z " , " m a i l " : n u l l , " m a i l N i c k n a m e " : " W i n R M R e m o t e W M I U s e r s _ _ " , " m a i l E n a b l e d " : f a l s e , " o n P r e m i s e s S e c u r i t y I d e n t i f i e r " : " S - 1 - 5 - 2 1 - 1 9 9 3 1 2 3 7 7 4 - 3 4 5 8 5 4 7 3 4 5 - 3 7 0 3 2 7 9 7 4 2 - x x x x " , " p r o v i s i o n i n g E r r o r s " : [ ] , " p r o x y A d d r e s s e s " : [ ] , " s e c u r i t y E n a b l e d " : t r u e } , { " o d a t a . t y p e " : " M i c r o s o f t . D i r e c t o r y S e r v i c e s . G r o u p " , " o b j e c t T y p e " : " G r o u p " , " o b j e c t I d " : " b 3 0 4 2 6 e 5 - x x x x - x x x x - x x x x - e 7 c 1 0 7 4 d 1 2 1 e " , " d e l e t i o n T i m e s t a m p " : n u l l , " d e s c r i p t i o n " : n u l l , " d i r S y n c E n a b l e d " : n u l l , " d i s p l a y N a m e " : " F I M S y n c B r o w s e " , " l a s t D i r S y n c T i m e " : n u l l , " m a i l " : n u l l , " m a i l N i c k n a m e " : " F I M S y n c B r o w s e " , " m a i l E n a b l e d " : f a l s e , " o n P r e m i s e s S e c u r i t y I d e n t i f i e r " : " S - 1 - 5 - 2 1 - 1 6 1 9 9 1 8 6 0 7 - 3 0 3 4 8 9 4 2 0 4 - 2 7 1 0 8 4 2 4 3 6 - x x x x " , " p r o v i s i o n i n g E r r o r s " : [ ] , " p r o x y A d d r e s s e s " : [ ] , " s e c u r i t y E n a b l e d " : t r u e } , { " o d a t a . t y p e " : " M i c r o s o f t . D i r e c t o r y S e r v i c e s . G r o u p " , " o b j e c t T y p e " : " G r o u p " , " o b j e c t I d " : " b 3 5 1 b d 7 f - x x x x - x x x x - x x x x - d 7 c c 9 1 8 5 2 9 4 1 " , " d e l e t i o n T i m e s t a m p " : n u l l , " d e s c r i p t i o n " : n u l l , " d i r S y n c E n a b l e d " : n u l l , " d i s p l a y N a m e " : " F I M S y n c P a s s w o r d S e t " , " l a s t D i r S y n c T i m e " : n u l l , " m a i l " : n u l l , " m a i l N i c k n a m e " : " F I M S y n c P a s s w o r d S e t " , " m a i l E n a b l e d " : f a l s e , " o n P r e m i s e s S e c u r i t y I d e n t i f i e r " : " S - 1 - 5 - 2 1 - 1 6 1 9 9 1 8 6 0 7 - 3 0 3 4 8 9 4 2 0 4 - 2 7 1 0 8 4 2 4 3 6 - x x x x " , " p r o v i s i o n i n g E r r o r s " : [ ] , " p r o x y A d d r e s s e s " : [ ] , " s e c u r i t y E n a b l e d " : t r u e } , { " o d a t a . t y p e " : " M i c r o s o f t . D i r e c t o r y S e r v i c e s . G r o u p " , " o b j e c t T y p e " : " G r o u p " , " o b j e c t I d " : " b 8 c 3 e 5 9 0 - x x x x - x x x x - x x x x - 8 2 c 3 a d 1 5 0 d 7 9 " , " d e l e t i o n T i m e s t a m p " : n u l l , " d e s c r i p t i o n " : " M e m b e r s i n t h e g r o u p h a v e t h e r e q u i r e d a c c e s s a n d p r i v i l e g e s t o b e a s s i g n e d a s t h e l o g o n a c c o u n t f o r t h e a s s o c i a t e d i n s t a n c e o f S Q L S e r v e r A c t i v e D i r e c t o r y H e l p e r i n S Q L S e r v e r 2 0 0 8 . " , "dirSyncEnabled":true,"displayName":"SQLServerMSSQLServerADHelperUser","lastDirSyncTime":"2014-12-19T03:38:25Z","mail":null,"mailNickname":"SQLServerMSSQLServerADHelperUser","mailEnabled":false,"onPremisesSecurityIdentifier":"S-1-5-21-1993123774-3458547345-3703279742-xxxx","provisioningErrors":[],"proxyAddresses":[],"securityEnabled":true},{"odata.type":"Microsoft.DirectoryServices.Group","objectType":"Group","objectId":"ba74d1e1-xxxx-xxxx-xxxx-ba7733c5f248","deletionTimestamp":null,"description":null,"dirSyncEnabled":null,"displayName":"FIMSyncJoiners","lastDirSyncTime":null,"mail":null,"mailNickname":"FIMSyncJoiners","mailEnabled":false,"onPremisesSecurityIdentifier":"S-1-5-21-1619918607-3034894204-2710842436-xxxx","provisioningErrors":[],"proxyAddresses":[],"securityEnabled":true},{"odata.type":"Microsoft.DirectoryServices.Group","objectType":"Group","objectId":"c302433d-fa52-40fc-97bb-d4b17331db77","deletionTimestamp":null,"description":"Administrators for %DOMAIN%","dirSyncEnabled":null,"displayName":"%DOMAIN% Administrators","lastDirSyncTime":null,"mail":null,"mailNickname":"d9026cd3-xxxx-xxxx-xxxx-f1b90bf7935c","mailEnabled":false,"onPremisesSecurityIdentifier":null,"provisioningErrors":[],"proxyAddresses":[],"securityEnabled":true},{"odata.type":"Microsoft.DirectoryServices.Group","objectType":"Group","objectId":"c657ef3c-xxxx-xxxx-xxxx-b9f48cf659da","deletionTimestamp":null,"description":"DNS Administrators Group","dirSyncEnabled":true,"displayName":"DnsAdmins","lastDirSyncTime":"2014-12-19T03:38:25Z","mail":null,"mailNickname":"DnsAdmins","mailEnabled":false,"onPremisesSecurityIdentifier":"S-1-5-21-1993123774-3458547345-3703279742-xxxx","provisioningErrors":[],"proxyAddresses":[],"securityEnabled":true},{"odata.type":"Microsoft.DirectoryServices.Group","objectType":"Group","objectId":"cc4ec8c6-xxxx-xxxx-xxxx-ab5a1b2ea5f3","deletionTimestamp":null,"description":null,"dirSyncEnabled":null,"displayName":"Administrators","lastDirSyncTime":null,"mail":null,"mailNickname":"BposMailNickName","mailEnabled":false,"onPremisesSecurityIdentifier":null,"provisioningErrors":[],"proxyAddresses":[],"securityEnabled":true},{"odata.type":"Microsoft.DirectoryServices.Group","objectType":"Group","objectId":"cda3c0e8-xxxx-xxxx-xxxx-964323393fe0","deletionTimestamp":null,"description":"Members in the group have the required access and privileges to be assigned as the log on account for the associated instance of SQL Server Agent.","dirSyncEnabled":true,"displayName":"SQLServerSQLAgentUser$SQLEXPRESS","lastDirSyncTime":"2014-12-19T03:38:25Z","mail":null,"mailNickname":"SQLServerSQLAgentUser_SQLEXPRESS","mailEnabled":false,"onPremisesSecurityIdentifier":"S-1-5-21-1993123774-3458547345-3703279742-xxxx","provisioningErrors":[],"proxyAddresses":[],"securityEnabled":true},{"odata.type":"Microsoft.DirectoryServices.Group","objectType":"Group","objectId":"e29d60e1-xxxx-xxxx-xxxx-c4c553ae802c","deletionTimestamp":null,"description":null,"dirSyncEnabled":true,"displayName":"ADSyncAdmins","lastDirSyncTime":"2014-12-19T03:38:25Z","mail":null,"mailNickname":"ADSyncAdmins","mailEnabled":false,"onPremisesSecurityIdentifier":"S-1-5-21-1993123774-3458547345-3703279742-xxxx","provisioningErrors":[],"proxyAddresses":[],"securityEnabled":true},{"odata.type":"Microsoft.DirectoryServices.Group","objectType":"Group","objectId":"e69fa9da-a214-4e32-a1f3-8064e3413ffa","deletionTimestamp":null,"description":null,"dirSyncEnabled":true,"displayName":"ADSyncOperators","lastDirSyncTime":"2014-12-19T03:38:25Z","mail":null,"mailNickname":"ADSyncOperators","mailEnabled":false,"onPremisesSecurityIdentifier":"S-1-5-21-1993123774-3458547345-3703279742-xxxx","provisioningErrors":[],"proxyAddresses":[],"securityEnabled":true},{"odata.type":"Microsoft.DirectoryServices.Group","objectType":"Group","objectId":"eca4dcea-xxxx-xxxx-xxxx-5bfdb52cc127","deletionTimestamp":null,"description":"Members in the group have the required access and privileges to be assigned as the login account for the specified instance of SQL Server.","dirSyncEnabled":true,"displayName":"SQLServerMSSQLUser$SQLEXPRESS","lastDirSyncTime":"2014-12-19T03:38:25Z","mail":null,"mailNickname":"SQLServerMSSQLUser_SQLEXPRESS","mailEnabled":false,"onPremisesSecurityIdentifier":"S-1-5-21-1993123774-3458547345-3703279742-xxxx","provisioningErrors":[],"proxyAddresses":[],"securityEnabled":true},{"odata.type":"Microsoft.DirectoryServices.Group","objectType":"Group","objectId":"f509a5a9-xxxx-xxxx-xxxx-eb6e6c4d1883","deletionTimestamp":null,"description":"demo","dirSyncEnabled":null,"displayName":"demo","lastDirSyncTime":null,"mail":null,"mailNickname":"b5ecf2f6-xxxx-xxxx-xxxx-0056132ccac4","mailEnabled":false,"onPremisesSecurityIdentifier":null,"provisioningErrors":[],"proxyAddresses":[],"securityEnabled":true}]}
------------------------------------------------------------------
GET https://graph.windows.net/%TENANT_ID%/groups/%GROUP_ID%?api-version=1.5 HTTP/1.1
DataServiceVersion: 1.0;NetFx
MaxDataServiceVersion: 3.0;NetFx
Accept: application/json;odata=minimalmetadata
Accept-Charset: UTF-8
DataServiceUrlConventions: KeyAsSegment
User-Agent: Microsoft ADO.NET Data Services
Authorization: %ACCESS_TOKEN%
X-ClientService-ClientTag: Office 365 API Tools 1.1.0612
Host: graph.windows.net
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-Type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8
Expires: -1
Server: Microsoft-IIS/8.5
ocp-aad-diagnostics-server-name: %SOME_KEY_2%
request-id: 1ae63825-xxxx-xxxx-xxxx-10135628a629
client-request-id: 6c971ab8-xxxx-xxxx-xxxx-4a794cdf8fb9
x-ms-gateway-rewrite: false
x-ms-dirapi-data-contract-version: 1.5
ocp-aad-session-key: %KEY%
X-Content-Type-Options: nosniff
DataServiceVersion: 3.0;
Strict-Transport-Security: max-age=31536000; includeSubDomains
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
X-Powered-By: ASP.NET
Date: Tue, 10 Feb 2015 22:19:34 GMT
Content-Length: 576
{"odata.metadata":"https://graph.windows.net/%TENANT_ID%/$metadata#directoryObjects/Microsoft.DirectoryServices.Group/@Element","odata.type":"Microsoft.DirectoryServices.Group","objectType":"Group","objectId":"%GROUP_ID%","deletionTimestamp":null,"description":"test@%DOMAIN%","dirSyncEnabled":null,"displayName":"TESTGROUP","lastDirSyncTime":null,"mail":null,"mailNickname":"%MAIL_NICKNAME%","mailEnabled":false,"onPremisesSecurityIdentifier":null,"provisioningErrors":[],"proxyAddresses":[],"securityEnabled":true}
------------------------------------------------------------------
GET https://graph.windows.net/%TENANT_ID%/users/%USER_ID%?api-version=1.5 HTTP/1.1
DataServiceVersion: 1.0;NetFx
MaxDataServiceVersion: 3.0;NetFx
Accept: application/json;odata=minimalmetadata
Accept-Charset: UTF-8
DataServiceUrlConventions: KeyAsSegment
User-Agent: Microsoft ADO.NET Data Services
Authorization: %ACCESS_TOKEN%
X-ClientService-ClientTag: Office 365 API Tools 1.1.0612
Host: graph.windows.net
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-Type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8
Expires: -1
Server: Microsoft-IIS/8.5
ocp-aad-diagnostics-server-name: %SOME_KEY_1%
request-id: 99314ed2-xxxx-xxxx-xxxx-ee71fd4ffbfe
client-request-id: d6b9b8a2-xxxx-xxxx-xxxx-98ec20e65198
x-ms-gateway-rewrite: false
x-ms-dirapi-data-contract-version: 1.5
ocp-aad-session-key: %KEY%
X-Content-Type-Options: nosniff
DataServiceVersion: 3.0;
Strict-Transport-Security: max-age=31536000; includeSubDomains
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
X-Powered-By: ASP.NET
Date: Tue, 10 Feb 2015 22:19:34 GMT
Content-Length: 1083
{"odata.metadata":"https://graph.windows.net/%TENANT_ID%/$metadata#directoryObjects/Microsoft.DirectoryServices.User/@Element","odata.type":"Microsoft.DirectoryServices.User","objectType":"User","objectId":"%USER_ID%","deletionTimestamp":null,"accountEnabled":true,"assignedLicenses":[],"assignedPlans":[],"city":null,"country":null,"department":null,"dirSyncEnabled":null,"displayName":"John Smith","facsimileTelephoneNumber":null,"givenName":"John","immutableId":null,"jobTitle":null,"lastDirSyncTime":null,"mail":null,"mailNickname":"%DOMAIN%ONMICROSOFT","mobile":null,"onPremisesSecurityIdentifier":null,"otherMails":["jsmith@%DOMAIN%"],"passwordPolicies":null,"passwordProfile":null,"physicalDeliveryOfficeName":null,"postalCode":null,"preferredLanguage":"en-us","provisionedPlans":[],"provisioningErrors":[],"proxyAddresses":[],"sipProxyAddress":null,"state":null,"streetAddress":null,"surname":"Smith","telephoneNumber":null,"usageLocation":"US","userPrincipalName":"jsmith@%DOMAIN%.onmicrosoft.com","userType":"Member"}
------------------------------------------------------------------
POST https://graph.windows.net/%TENANT_ID%/directoryObjects/%GROUP_ID%/Microsoft.DirectoryServices.Group/members?api-version=1.5 HTTP/1.1
DataServiceVersion: 3.0;NetFx
MaxDataServiceVersion: 3.0;NetFx
Content-Type: application/json;odata=minimalmetadata
Accept: application/json;odata=minimalmetadata
Accept-Charset: UTF-8
DataServiceUrlConventions: KeyAsSegment
User-Agent: Microsoft ADO.NET Data Services
Authorization: %ACCESS_TOKEN%
X-ClientService-ClientTag: Office 365 API Tools 1.1.0612
Host: graph.windows.net
Content-Length: 49
Expect: 100-continue
{"odata.type":"Microsoft.DirectoryServices.User"}
HTTP/1.1 400 Bad Request
Cache-Control: private
Content-Type: application/json;odata=minimalmetadata;charset=utf-8
Server: Microsoft-IIS/8.5
ocp-aad-diagnostics-server-name: %SOME_KEY_1%
request-id: 856504e9-xxxx-xxxx-xxxx-5bd2e6c64d44
client-request-id: a4ce7205-xxxx-xxxx-xxxx-77fad62c00f7
x-ms-gateway-rewrite: false
x-ms-dirapi-data-contract-version: 1.5
ocp-aad-session-key: %KEY%
Strict-Transport-Security: max-age=31536000; includeSubDomains
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
X-Powered-By: ASP.NET
Date: Tue, 10 Feb 2015 22:19:34 GMT
Content-Length: 164
{"odata.error":{"code":"Request_BadRequest","message":{"lang":"en","value":"A change set cannot include changes to more than '1' source resources."},"values":null}}
------------------------------------------------------------------
MERGE https://graph.windows.net/%TENANT_ID%/directoryObjects/%GROUP_ID%/Microsoft.DirectoryServices.Group?api-version=1.5 HTTP/1.1
DataServiceVersion: 3.0;NetFx
MaxDataServiceVersion: 3.0;NetFx
Content-Type: application/json;odata=minimalmetadata
Accept: application/json;odata=minimalmetadata
Accept-Charset: UTF-8
DataServiceUrlConventions: KeyAsSegment
User-Agent: Microsoft ADO.NET Data Services
Authorization: %ACCESS_TOKEN%
X-ClientService-ClientTag: Office 365 API Tools 1.1.0612
Host: graph.windows.net
Content-Length: 50
Expect: 100-continue
{"odata.type":"Microsoft.DirectoryServices.Group"}
HTTP/1.1 204 No Content
Cache-Control: no-cache
Pragma: no-cache
Expires: -1
Server: Microsoft-IIS/8.5
ocp-aad-diagnostics-server-name: %SOME_KEY_2%
request-id: f05a4c03-xxxx-xxxx-xxxx-fc245fd03452
client-request-id: f3627ada-xxxx-xxxx-xxxx-6c54958c5613
x-ms-gateway-rewrite: false
x-ms-dirapi-data-contract-version: 1.5
ocp-aad-session-key: %KEY%
X-Content-Type-Options: nosniff
DataServiceVersion: 1.0;
Strict-Transport-Security: max-age=31536000; includeSubDomains
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
X-Powered-By: ASP.NET
Date: Tue, 10 Feb 2015 22:19:35 GMT
------------------------------------------------------------------
ОБНОВЛЕНИЕ (15 февраля 2015 г.)
Дополнительный код:
private async Task AcquireToken()
{
if (String.IsNullOrEmpty(AccessToken))
{
throw new Exception("Authorization is Required.");
}
else
{
return AccessToken;
}
}
private ActiveDirectoryClient GetActiveDirectoryClient()
{
Uri baseServiceUri = new Uri('https://graph.windows.net');
ActiveDirectoryClient activeDirectoryClient = new ActiveDirectoryClient(new Uri(baseServiceUri , 'tenant_id'), async () => { return AccessToken; });
return activeDirectoryClient;
}
private IUser GetUserByObjectId(String objectId)
{
try
{
ActiveDirectoryClient client = GetActiveDirectoryClient();
return client.Users.GetByObjectId(objectId).ExecuteAsync().Result;
}
catch (Exception ex)
{
//handling exceptions
}
}
private IGroup GetGroupByObjectId(String objectId)
{
try
{
ActiveDirectoryClient client = GetActiveDirectoryClient();
return client.Groups.GetByObjectId(objectId).ExecuteAsync().Result;
}
catch (Exception ex)
{
//handling exceptions
}
}
Подробнее здесь: [url]https://stackoverflow.com/questions/28419155/c-a-change-set-cannot-include-changes-to-more-than-1-source-resources-when[/url]
Ответить
1 сообщение
• Страница 1 из 1
Перейти
- Кемерово-IT
- ↳ Javascript
- ↳ C#
- ↳ JAVA
- ↳ Elasticsearch aggregation
- ↳ Python
- ↳ Php
- ↳ Android
- ↳ Html
- ↳ Jquery
- ↳ C++
- ↳ IOS
- ↳ CSS
- ↳ Excel
- ↳ Linux
- ↳ Apache
- ↳ MySql
- Детский мир
- Для души
- ↳ Музыкальные инструменты даром
- ↳ Печатная продукция даром
- Внешняя красота и здоровье
- ↳ Одежда и обувь для взрослых даром
- ↳ Товары для здоровья
- ↳ Физкультура и спорт
- Техника - даром!
- ↳ Автомобилистам
- ↳ Компьютерная техника
- ↳ Плиты: газовые и электрические
- ↳ Холодильники
- ↳ Стиральные машины
- ↳ Телевизоры
- ↳ Телефоны, смартфоны, плашеты
- ↳ Швейные машинки
- ↳ Прочая электроника и техника
- ↳ Фототехника
- Ремонт и интерьер
- ↳ Стройматериалы, инструмент
- ↳ Мебель и предметы интерьера даром
- ↳ Cантехника
- Другие темы
- ↳ Разное даром
- ↳ Давай меняться!
- ↳ Отдам\возьму за копеечку
- ↳ Работа и подработка в Кемерове
- ↳ Давай с тобой поговорим...
Мобильная версия