Tag Info

Hot answers tagged

4

You only see the last error because Set-Content overwrites the existing content, use Add-Content instead. If you want to have a more encompassing approach, like Robert suggested, there's a more PowerShell'y (?) way of doing this with Start/Stop-Transcript which takes all console output between the Start & Stop cmdlet calls and outputs it to a file.


3

$RootFolder.SubFolders will give you the collection of folders. Loop through the collection and use StartsWith with each folder: $folders = $RootFolder.SubFolders; foreach ($folder in $folders) { if ($folder.Name.StartsWith("a")) { // Call $folder.Subfolders again to get folders present in this folder // Then use foreach to loop ...


2

You can get the document link using following line: var url = _spPageContextInfo.webAbsoluteUrl + oListItem.get_item('FileRef');


2

You can deploy apps locally if you have the app package. You upload them into the site catalog and they will be made available to your site collections. You won't be able to utilize apps deployed to the MS store. You would need to contact the vendor directly to see about obtaining an .app package or code your own and deploy them.


2

In general you should't be storing documents of big size in SharePoint. A better approach would be to store it on a file share or FTP and simply link to the file from SharePoint. You technically cannot store a file larger than 2 GB (2047 MB) to SharePoint. This is the maximum size. If you want to allow files up to 2 GB you'll need to increase the connection ...


1

Assuming you have the MemoryStream, the below code will bring the Save Dialog so user can choose the path Byte[] byteArray = memoryStream.ToArray(); memoryStream.Flush(); memoryStream.Close(); Response.Clear(); Response.ClearHeaders(); Response.AddHeader("Content-Disposition","attachment; filename=filename.zip"); Response.ContentType = ...


1

Ok, I solved it as follows (inspired by this post) - might be helpful for someone else... The idea is to start from the back, removing more and more tokens between '/' from the path until we find the lowest level site URL, which we then use to instantiate the correct ClientContext for the given folder url. The folder itself can then be referenced using ...


1

In the SharePoint website, go to the library which stores the files you wish to extract. Click the Library option at the top of the page. Among the many confusing buttons is one that says "Open with Explorer." Click this to open the library in Windows [File] Explorer. From here you can select multiple files and drag&drop or copy&paste into a folder ...


1

After a long day, it turned out that for successfully using the Powershell DownloadFile() method, in my environment (SP2013 with ADFS) following two lines did the trick(at least for me). $wc.UseDefaultCredentials = $true $wc.Headers.Add("X-FORMS_BASED_AUTH_ACCEPTED", "f") So, the final code looks like, $FilePath = ...


1

Try this $wc = New-Object System.Net.WebClient $wc = New-Object System.Net.Networkcredential(Username, Password) $UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)" $wc.Headers.Add([System.Net.HttpRequestHeader]::UserAgent, $UserAgent);


1

Thanks for the responses, Actually I came across a remedy in a similar article Referring to tha post answer, in my code I invoked the below javascript OnClientClick event of the LinkButton. function setFormSubmitToFalse() { setTimeout(function () { _spFormOnSubmitCalled = false; }, 3000); return true; }


1

Please look at the EncodedAbsUrl, FileDirRef, and FileRef properties. The one you use depends on your needs but I suspect you'll want EncodedAbsUrl or FileRef. Here is an example of what each returns: EncodedAbsUrl: http://yourserver.com/Pages/home.aspx FileDirRef: /Pages FileRef: /Pages/home.aspx var ctx = new SP.ClientContext(siteUrl); var items = ...


1

That's more a case of LMGTFY - Here's a complete tutorial plus a .wsp to add this function. To get some basic understanding Since you can't download multiple files in one response, you need to package them in a .zip for example. What you have to do is getting the byte[] foreach file and package them together. Then add created .zip to the response to invoke ...


1

SharePoint registers a JavaScript "on submit" handler. In this handler the global variable _spFormOnSubmitCalled is set to true. SharePoint uses this variable to check if a submit was executed and prevents any further submits. Since your "download postback" does not refresh the page this variable remains true. With the effect that that all other buttons stop ...


1

Sorry. I corrected My Try catch Block and its seems To be Working Fine if((Get-PSSnapin "Microsoft.SharePoint.PowerShell") -eq $null) { Add-PSSnapin Microsoft.SharePoint.PowerShell } $destination = "C:\\Test\\" $web = Get-SPWeb -Identity "http://xyz:4444/" $list = $web.GetList("http://xyx:4444/Shared Documents/") function ProcessFolder { ...


1

You could use Write-Output "Logging text" in your catches and then when you run the script you can run it as MyFancyScriptName.ps1 > C:\file.log


1

You could use the REST service, but since you are downloading this amount of data you could as well use the CSOM. Try this: Install the Microsoft.SharePoint.Client package from NuGet: Install-Package Microsoft.SharePoint.Client (This package is for 2010, but it will work for 2013 as well). Then use this code: const string host = "http://2013-sp"; const ...



Only top voted, non community-wiki answers of a minimum length are eligible