나는 다음과 같은 오류를 받고 있어요 :잘못된 요청 오류 400 MS-그래프 OneNote 전자 API
{
StatusCode: 400,
ReasonPhrase: 'Bad Request',
Version: 1.1,
Content: System.Net.Http.StreamContent,
Headers:
{
client-request-id: 09bcf6bf-1c4a-4f9d-9713-42dfbed17ecd
request-id: 09bcf6bf-1c4a-4f9d-9713-42dfbed17ecd
Transfer-Encoding: chunked
x-ms-ags-diagnostic: {"ServerInfo":{"DataCenter":"South Central US","Slice":"SliceB","ScaleUnit":"002","Host":"AGSFE_IN_3","ADSiteName":"SAN"}}
Duration: 395.8064
Cache-Control: private
Date: Tue, 26 Sep 2017 17:28:22 GMT
Content-Type: application/json
}
}
나는 노트북의 새로운 섹션을 만들려면이 코드를 사용하는 경우 : 내가 가지고있는
/// Create a new Section with the Patient Name as the displayName
tempSectionName = LastNameEdit.Text.ToString() + " " + FirstNameEdit.Text.ToString();
string url = "https://graph.microsoft.com/v1.0/me/onenote/";
CreateSectionInNotebook(Globals.CurrentEMRNotebookID, tempSectionName, url);
}
/// <summary>
/// Create a section with a given name under a given notebookId
/// </summary>
/// <param name="notebookId">parent notebook's Id</param>
/// <param name="sectionName">name of the section to create</param>
/// <param name = "apiRoute" ></ param >
/// <remarks>Create section using a application/json content type</remarks>
private async void CreateSectionInNotebook(string notebookId, string sectionName, string apiRoute)
{
var client = new HttpClient();
// Note: API only supports JSON response.
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
// Not adding the Authentication header would produce an unauthorized call and the API will return a 401
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", authResult.AccessToken);
// Prepare an HTTP POST request to the Sections endpoint
// The request body content type is application/json and require a name property
var createMessage = new HttpRequestMessage(HttpMethod.Post, apiRoute + @"notebooks/" + notebookId + "/sections")
{
Content = new StringContent("{ name : '" + WebUtility.UrlEncode(sectionName) + "' }", Encoding.UTF8, "application/json")
};
HttpResponseMessage response = await client.SendAsync(createMessage);
}
을 OneNote Service Samples Win Universal의 입력을 일치 시키려고 시도했지만 OneNote API를 사용합니다.
Microsoft Graph Explorer가 MSGraph
/OneNote
의 기능을 확장 한 경우 APIgee
에 OneNote API가있는 것이 좋을 것입니다.