Projekt-Anfragen: Tel: 07022/9319004 info@CodeDocu.de Software Entwicklung in C# WPF Asp.Net Core Vba Excel Word SQL-Server EF Linq, UWP Net
#

Offen: Sharepoint upload File Error

 

Error: Error making HttpClient request in queryable [400] Bad Request ::> {"odata.error":{"code":"-2147024809, System.ArgumentException","message":{"lang":"de-DE","value":"Server relative urls must start with SPWeb.ServerRelativeUrl"}}}

 

 

Upload script in Client für Webpart

VS Code

    private _UploadClicked(_evt) {

        UploadDocument.Me.setState({ waitHidden: false });

        sp.setup({ spfxContext: UploadDocument.Me.props.controller.context });

        var listId = UploadDocument.Me.props.controller.QueryStringParameter("listid");

        var processId = UploadDocument.Me.props.controller.QueryStringParameter("pid");

        var filesHTMLInputElement = document.getElementById("fileUpload"as HTMLInputElement;

        var listNamestring;

        UploadDocument.Me.props.controller.GetListNameById(Guid.parse(listId)).then(list => {

            listName = list.Title;

            var file = files.files[0];

            UploadDocument.Me.props.controller.HasListRight(Permissions.addListItemsGuid.parse(listId)).then(r => {

                if (r) {

                    console.log("Benutzer hat Rechte Files hinzuzufügen");

                }

                else {

                    console.log("Benutzer hat keine Rechte Files hinzuzufügen");

                }

            });

            console.log("Listname: " + listName);

            //Upload a file to the SharePoint Library

            UploadDocument.Me.props.controller.GetRootFolderById(Guid.parse(listId)).then(fld => {

                var folderId = fld.UniqueId;

                console.log("FolderId: " + folderId);

                var folderRelativUrl = fld.ServerRelativeUrl;

                console.log("FolderRelativUrl: " + folderRelativUrl);

 

                var folderFolder = sp.web.getFolderById(Guid.parse(folderId).toString());

                console.log(sp.web.rootFolder.toUrl);

                sp.web.getFolderByServerRelativeUrl(folderRelativUrl).files.add(file.name, file, true).then(x => {

                    console.log("Progress ...");

                    UploadDocument.Me.setState({ waitHidden: true });

                });

                //console.log("FolderUrl: " + folder.Name);

                console.log("Filename: " + file.name);

 

 

Mobile
»
Error: Server relative urls must start with SPWeb.ServerRelativeUrl
»
Fehlermeldung Sharepoint Online aktivieren der Communitywebsite
»
Offen: Sharepoint upload File Error

.

Jobs, Projekte, Angebote für Freiberufler, Selbstständig an Info@CodeDocu.de