如何使用Microsoft.Graph将文件附加到Sharepoint中的项目

时间:2017-12-14 09:38:26

标签: c# sharepoint microsoft-graph

Microsoft.Graph Sharepoint api允许使用PATCH请求更新列表项https://developer.microsoft.com/en-us/graph/docs/api-reference/beta/api/listitem_update。但是如何生成正确的请求?

    using (HttpClient pacthClient = new HttpClient())
    {
        var mediaType = new MediaTypeWithQualityHeaderValue("application/json");
        pacthClient.DefaultRequestHeaders.Accept.Add(mediaType);
        pacthClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", userToken);
        using (HttpRequestMessage requestMessage = new HttpRequestMessage(new HttpMethod("PATCH"), $"{uri}/{id}"))
        {
            requestMessage.Content = byteArrayContent ???
            using (HttpResponseMessage responseMessage = await pacthClient.SendAsync(requestMessage))
            {
            }
        }
    }

1 个答案:

答案 0 :(得分:0)

train_sample.time.hour
AttributeError: 'Series' object has no attribute 'hour'

train_sample.time.dt.hour
AttributeError: Can only use .dt accessor with datetimelike values 

pd.DatetimeIndex(train_sample.time).hour
TypeError: <class 'datetime.time'> is not convertible to datetime