我想创建一个文件夹并使用rest api上传文件我的代码是这样的
public string CreateFolder(string FolderName)
{
int WorkSpaceId = 330201;
int id = 168079105;
var queryString = HttpContext.Current.Session["tokenSession"];
var request = WebRequest.Create(RequestProfileUrl + FolderName);
request.AuthenticationLevel = System.Net.Security.AuthenticationLevel.None;
request.Headers.Add("Authorization", "Bearer " + AccessToken);
request.ContentType = "multipart/form-data";
request.Method = "POST";
var response = request.GetResponse();
HttpContext.Current.Response.Redirect("" + request.RequestUri);
using (var responseStream = response.GetResponseStream())
{
var reader = new StreamReader(responseStream);
var responseText = reader.ReadToEnd();
reader.Close();
return responseText;
}
}
我必须这样做
POST https://apis.live.net/v5.0/me/skydrive
Authorization: Bearer ACCESS_TOKEN
Content-Type: multipart/form-data
{
"name": "My example folder"
}`
我添加了请求标头和内容类型,我不知道如何name
向我的请求添加参数。