Thursday, 19 September 2019

Sharepoint upload file increase and Links

Error:

The request message is too big. The server does not allow messages larger than 2097152 bytes

Solution:

Run script  in Sharepoint Power Shell :
$ws = [Microsoft.SharePoint.Administration.SPWebService]::ContentService
$ws.ClientRequestServiceSettings.MaxReceivedMessageSize = 20242880
$ws.ClientRequestServiceSettings.MaxParseMessageSize  = 20242880
$ws.Update()

====================
     string documentBody1 = _itemAttachment.Attributes["body"].ToString();
var aaa=new  MemoryStream(Convert.FromBase64String(documentBody1));

   public static void UploadFileToSP(ClientContext ctx, string listName, string fullUrlWithFileName, byte[] content,MemoryStream aaa)
        {
            //  Send the file content to SP
            Microsoft.SharePoint.Client.List list = ctx.Web.Lists.GetByTitle(listName);
            FileCreationInformation file1 = new FileCreationInformation();
            file1.Overwrite = true;
            file1.Url = fullUrlWithFileName;// "/demo/email/57FD46F959DBE81180C200155D668D45_testfilename";// fullUrlWithFileName;
                                            // file1.Content = content;
            file1.ContentStream = aaa;
            Microsoft.SharePoint.Client.File uploadFile = list.RootFolder.Files.Add(file1);
            //list.con
            ctx.Load(uploadFile);
            ctx.ExecuteQuery();
        }
=========================

Sharepoint 'Sync Now' functionality and share files on network drive

https://bitwizards.com/thought-leadership/blog/2015/december-2015/how-to-map-sharepoint-document-libraries-as-networ

https://support.office.com/en-us/article/sync-sharepoint-files-with-the-onedrive-for-business-sync-client-groove-exe-59b1de2b-519e-4d3a-8f45-51647cf291cd


Sharepoint upload solution in SP:
https://sharepoint.stackexchange.com/questions/189704/how-to-upload-a-sharepoint-site-template-wsp-when-the-solution-link-is-missin

https://www.c-sharpcorner.com/UploadFile/93cb27/deploying-the-solution-in-sharepoint-online/

Powershell Script:
Power shell Script

./AllowHtcExtn.ps1 https://mysharepointserver/CRM 




SharePoint Online

FileCreationInformation.Content=Convert.FromBase64String(fileData);
//fileData being the document body of my attachment.

Instead of using the Content method of FileCreationInformation, I used ContentStream as below:

FileCreationInformation.Content=new MemoryStream(Convert.FromBase64String(fileData));



3 comments:

  1. the post was highly educative and helpful thanks for providing the accurate and to the point commands that could help a beginner learn sharepoint and its concepts specially for integration with other applications in context with integration and document management......Arunav

    ReplyDelete
  2. Hope to see such articles more!!

    ReplyDelete