none
SharePoint Create Folder fails randomly with CSOM RRS feed

  • Question

  • I have implemented an upload process for SharePoint with C# in Azure Functions and CSOM. The upload process will also create folders in SharePoint recursive.

    The following error will be thrown after some folders are created:

    {"parameters.Content, parameters.ContentStream\r\nParameter name: The specified value is not supported for the parameters.Content, parameters.ContentStream parameter"}.


    Code (dest is the destination context):

    Folder _folder = dest.Web.GetFolderByServerRelativeUrl(folder.ServerRelativeUrl);
    _folder.Folders.AddWithOverwrite(folder.ServerRelativeUrl+"/"+item.Property.Name,true);
    dest.Load(_folder);
    dest.ExecuteQuery();


    Tuesday, April 20, 2021 2:00 PM

All replies

  • Not sure but try once to redefined the CreateFolder and CreateFolderInternal

    Tuesday, April 27, 2021 7:56 PM
  • thanks
    Tuesday, May 25, 2021 8:16 AM
  • If you create a new folder and upload file into another SharePoint online document library does you and your teammate meet the same behavior, it will help for us to narrow down your issue.

    May I know have you tried another bowser like “Microsoft edge” does it make any difference, please verify the result with us.

    In the meantime, if there is no issue with your SharePoint online document library, you may try another way to create a new folder and upload file on your SharePoint library to meet your requirement.

    Please try to sync your affected SharePoint online document library to local machine using OneDrive client app and then try to create a new folder or upload file in sync document library then go to SharePoint library via bowser to check the outcomes.

    This may help you,

    Rachel Gomez

    Friday, August 19, 2022 4:54 AM
  • The error message indicates that the value provided for the parameters.Content or parameters.ContentStream parameter is not supported. However, based on the code snippet provided, it does not seem to be related to the upload process or the creation of folders.

    The error could be caused by an invalid value being passed to the parameters.Content or parameters.ContentStream parameter in another part of your code. It is recommended to review the code and ensure that all parameters are properly validated and that the correct data types are being passed.

    Another possibility is that the error is related to the destination context. It is recommended to check that the destination context is properly initialized and that the correct SharePoint site URL is being used.

    Finally, it is recommended to add error handling to your code to provide more detailed error messages and to handle exceptions gracefully. This will make it easier to troubleshoot issues like this in the future.

    Thursday, February 23, 2023 1:45 PM
  • I was just making an account at https://bc.game/id when I saw your answer. Anyway, thank you for your helpful response! I will review my code too and ensure that the content is properly formatted to resolve the issue with what you said.
    • Edited by Juljit Chumchai Wednesday, March 8, 2023 3:24 AM message got doubled
    Wednesday, March 8, 2023 3:23 AM
  • The error message you are receiving indicates that the value you are passing to the parameters.Content or parameters.ContentStream parameter is not supported.

    In your code, it appears that you are trying to create a new folder in SharePoint using the AddWithOverwrite method, passing the folder.ServerRelativeUrl and item.Property.Name parameters. It's possible that one of these parameters is causing the issue.

    To troubleshoot this error, you can try the following steps:

    1. Check the values of folder.ServerRelativeUrl and item.Property.Name to ensure that they are valid SharePoint URLs.

    2. Verify that the dest object is initialized correctly and has the necessary permissions to create folders in SharePoint.

    3. Try uploading a file to the same folder using the UploadFile method to see if you receive a similar error. This will help you isolate whether the issue is specific to the AddWithOverwrite method or a more general issue with uploading content to SharePoint.

    4. Try using a different method to create the folder, such as dest.Web.Folders.Add(folder.ServerRelativeUrl + "/" + item.Property.Name) to see if you receive a different error message.

    If none of these steps resolve the issue, it may be helpful to consult the SharePoint documentation or seek assistance from Microsoft support to troubleshoot the issue further.

    Friday, March 10, 2023 4:44 PM
  • Cảm ơn bạn đã làm theo hướng dẫn
    Monday, March 20, 2023 3:12 PM