You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In my case I have tried to create a sharepoint folder, which I wanted to further modify by changing its content type to document set.
I wanted to use SharePointIds of driveItem.
However creating the folder with:
var folder = new DriveItem()
{
Folder = new Folder(),
};
await client.Drives[driveId].Root.ItemWithPath(folderPath).PatchAsync(folder, config => {
//change of config.QueryParameters
});
does not return sharePointIds by default, so it needs $select=sharepointIds query parameter, which is supported by the api but not with the DefaultQueryParameters.
Probable solution
Creating DriveItemItemRequestBuilderPatchQueryParameters with $select and $expand queryParams properties which would be used similar way as DriveItemItemRequestBuilderGetQueryParameters in the DriveItemItemRequestBuilder.GetAsync should in my opinion resolve this.
Hack I have tried
I have also tried to solve this with a workaround of creating my own QueryParameters class and using it as such:
public class DriveItemPatchQueryParameters : DefaultQueryParameters
{
[QueryParameter("%24select")]
public string[]? Select { get; set; } = [ "sharepointIds" ];
}
await client.Drives[driveId].Root.ItemWithPath(folderPath).PatchAsync(folder, config => {
config.QueryParameters = new DriveItemPatchQueryParameters();
});
However the RequestInformation.AddQueryParameters gets the query string properties with typeof(T).GetProperties() which means only base type (DefaultQueryParameters in this case) properties are used. If source.GetType().GetProperties() would be used it could allow more customization. But I think the current behavior is intended. I am just mentioning this for consideration.
Contribution question
I would try to implement this on my own, but considering I do not have any experience with open source contribution I would like to ask for some kind of "go ahead" from someone knowledgeable in case you think it is appropriate.
The text was updated successfully, but these errors were encountered:
Same is the case with ContentRequestBuilder PutAsync for uploading small file contents. PutAsync is using DefaultQueryParameters, no option to select SharePoint ids.
Issue
In my case I have tried to create a sharepoint folder, which I wanted to further modify by changing its content type to document set.
I wanted to use SharePointIds of driveItem.
However creating the folder with:
var folder = new DriveItem()
{
Folder = new Folder(),
};
await client.Drives[driveId].Root.ItemWithPath(folderPath).PatchAsync(folder, config => {
//change of config.QueryParameters
});
does not return sharePointIds by default, so it needs $select=sharepointIds query parameter, which is supported by the api but not with the DefaultQueryParameters.
Probable solution
Creating DriveItemItemRequestBuilderPatchQueryParameters with $select and $expand queryParams properties which would be used similar way as DriveItemItemRequestBuilderGetQueryParameters in the DriveItemItemRequestBuilder.GetAsync should in my opinion resolve this.
Hack I have tried
I have also tried to solve this with a workaround of creating my own QueryParameters class and using it as such:
public class DriveItemPatchQueryParameters : DefaultQueryParameters
{
[QueryParameter("%24select")]
public string[]? Select { get; set; } = [ "sharepointIds" ];
}
await client.Drives[driveId].Root.ItemWithPath(folderPath).PatchAsync(folder, config => {
config.QueryParameters = new DriveItemPatchQueryParameters();
});
However the RequestInformation.AddQueryParameters gets the query string properties with typeof(T).GetProperties() which means only base type (DefaultQueryParameters in this case) properties are used. If source.GetType().GetProperties() would be used it could allow more customization. But I think the current behavior is intended. I am just mentioning this for consideration.
Contribution question
I would try to implement this on my own, but considering I do not have any experience with open source contribution I would like to ask for some kind of "go ahead" from someone knowledgeable in case you think it is appropriate.
The text was updated successfully, but these errors were encountered: