public ActionResult GrantAccess(OfficeAccessModel roomDocumentModel) { string accessToken = RequestItemsService.User.AccessToken; var basePath = $"{RequestItemsService.Session.RoomsApiBasePath}/restapi"; // Base API path var apiClient = new ApiClient(basePath); apiClient.Configuration.DefaultHeader.Add("Authorization", "Bearer " + accessToken); var formGroupsApi = new FormGroupsApi(apiClient); string accountId = RequestItemsService.Session.AccountId; try { // Step 5 start formGroupsApi.GrantOfficeAccessToFormGroup(accountId, new Guid(roomDocumentModel.FormGroupId), roomDocumentModel.OfficeId); // Step 5 end ViewBag.h1 = "Access is granted for the office"; ViewBag.message = $"To the office with Id'{roomDocumentModel.OfficeId}' granted access for the form group with id '{roomDocumentModel.FormGroupId}'"; return(View("example_done")); } catch (ApiException apiException) { ViewBag.errorCode = apiException.ErrorCode; ViewBag.errorMessage = apiException.Message; return(View("Error")); } }
/// <summary> /// Grants office access to a form group /// </summary> /// <param name="basePath">BasePath for API calls (URI)</param> /// <param name="accessToken">Access Token for API call (OAuth)</param> /// <param name="accountId">The DocuSign Account ID (GUID or short version) for which the APIs call would be made</param> /// <param name="formGroupId">The Id of the specified form group</param> /// <param name="officeId">The Id of the specified office</param> /// <returns></returns> public static void GrantAccess( string basePath, string accessToken, string accountId, string formGroupId, int?officeId) { // Construct your API headers var apiClient = new ApiClient(basePath); apiClient.Configuration.DefaultHeader.Add("Authorization", "Bearer " + accessToken); var formGroupsApi = new FormGroupsApi(apiClient); // Call the Rooms API to grant office access to a form group formGroupsApi.GrantOfficeAccessToFormGroup(accountId, new Guid(formGroupId), officeId); }