Save output of powershell script to a SharePoint document library?

Hi
I've got the PS script below which scripts out our SQL replication so disaster recovery.  Is there a way to output this to a SharePoint document library so that way we can version control the file to keep multiple copies and it also avoids outputting
this to a file share.  We would still need to have the files with the .sql extension format which is an allowed file type in our farm.
Thanks
#Load command-line parameters - if they exist
param ([string]$sqlserver, [string]$filename)
#Reference RMO Assembly
[reflection.assembly]::LoadWithPartialName("Microsoft.SqlServer.Replication") | out-null
[reflection.assembly]::LoadWithPartialName("Microsoft.SqlServer.Rmo") | out-null
function errorhandler([string]$errormsg)
    writetofile ("-- Replication Script Generator run at: " + (date)) $filename 1
    writetofile ("-- [Replication Script ERROR] " + $errormsg) $filename 0
function writetofile([string]$text, [string]$myfilename, [int]$cr_prefix)
    if ($cr_prefix -eq 1) { "" >> $myfilename }
    $text >> $myfilename
function initializefile([string]$myfilename)
    "" > $myfilename
trap {errorhandler($_); Break}
#Deal with absent parameters
[string] $hostname=hostname
if ($sqlserver -eq "") {$sqlserver = read-host -prompt "Please enter the server name or leave blank for Hostname"}
#if ($filename -eq "")  {$filename = read-host -prompt "Please enter the file name (eg 'c:\ReplicationBackupScript.sql')..."}
if ($sqlserver -eq "")   {$sqlserver = $hostname}
if ($filename -eq "")   {$filename = "d:\Rep\CreateReplication-$(get-date -format ddMMyyyy).sql"}
# Clear file contents
if (Test-Path  ($filename)) {Clear-Content $filename}
$repsvr=New-Object "Microsoft.SqlServer.Replication.ReplicationServer" $sqlserver
initializefile $filename
# if we don't have any replicated databases then there's no point in carrying on
if ($repsvr.ReplicationDatabases.Count -eq 0)
    writetofile ("-- Replication Script Generator run at: " + (date)) $filename 0
    writetofile "-- ZERO replicated databases on $sqlserver!!!" $filename 1
    EXIT
# similarly, if we don't have any publications then there's no point in carrying on
[int] $Count_Tran_Pub = 0
[int] $Count_Merge_Pub = 0
foreach($replicateddatabase in $repsvr.ReplicationDatabases)
        $Count_Tran_Pub = $Count_Tran_Pub + $replicateddatabase.TransPublications.Count
        $Count_Merge_Pub = $Count_Merge_Pub + $replicateddatabase.MergePublications.Count
if (($Count_Tran_Pub + $Count_Merge_Pub) -eq 0)
    writetofile ("-- Replication Script Generator run at: " + (date)) $filename 0
    writetofile "-- ZERO Publications on $sqlserver!!!" $filename 1
    EXIT
# if we got this far we know that there are some publications so we'll script them out
# the $scriptargs controls exactly what the script contains
# for a full list of the $scriptargs see the end of this script
$scriptargs = [Microsoft.SqlServer.Replication.scriptoptions]::Creation `
-bor  [Microsoft.SqlServer.Replication.scriptoptions]::IncludeEnableReplicationDB `
-bor  [Microsoft.SqlServer.Replication.scriptoptions]::IncludeCreateLogreaderAgent `
-bor  [Microsoft.SqlServer.Replication.scriptoptions]::IncludePublicationAccesses `
-bor  [Microsoft.SqlServer.Replication.scriptoptions]::IncludeArticles `
-bor  [Microsoft.SqlServer.Replication.scriptoptions]::IncludePublisherSideSubscriptions `
-bor  [Microsoft.SqlServer.Replication.scriptoptions]::IncludeSubscriberSideSubscriptions
writetofile ("-- Replication Script Generator run at: " + (date)) $filename 0
writetofile "-- PUBLICATIONS ON $sqlserver" $filename 1
writetofile "-- TRANSACTIONAL PUBLICATIONS ($Count_Tran_Pub)" $filename 1
foreach($replicateddatabase in $repsvr.ReplicationDatabases)
    if ($replicateddatabase.TransPublications.Count -gt 0)
        foreach($tranpub in $replicateddatabase.TransPublications)
            writetofile "/********************************************************************************" $filename 0
            writetofile ("***** Writing to file script for publication: " + $tranpub.Name) $filename 0
            writetofile "********************************************************************************/" $filename 0
            [string] $myscript=$tranpub.script($scriptargs) 
            writetofile $myscript $filename 0
writetofile "-- MERGE PUBLICATIONS ($Count_Merge_Pub)" $filename 1
foreach($replicateddatabase in $repsvr.ReplicationDatabases)
    if ($replicateddatabase.MergePublications.Count -gt 0)
        foreach($mergepub in $replicateddatabase.MergePublications)
            writetofile "/********************************************************************************" $filename 0
            writetofile ("***** Writing to file script for publication: " + $mergepub.Name) $filename 0
            writetofile "********************************************************************************/" $filename 0
            [string] $myscript=$mergepub.script($scriptargs) 
            writetofile $myscript $filename 0

Check out Using PowerShell to upload a scripts output to SharePoint
Jason Warren
@jaspnwarren
jasonwarren.ca
habaneroconsulting.com/Insights

Similar Messages

  • Powershell Script to create "custom" Document Library

    I have a powershell script which creates a Document Library for every user in AD.
    This works, but rather than using the default Document Library I want it use a custom Document Library.  However this isnt working.
    My script to create the default Document Library is this...
    [System.Reflection.Assembly]::Load("Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c")
    $site = new-object Microsoft.SharePoint.SPSite("http://servername/sitename");
    $siteweb = $site.OpenWeb();
    $webs = $siteweb.Webs;
    $strFilter = "(&(objectCategory=User)(name=accountname))"
    $objDomain = New-Object System.DirectoryServices.DirectoryEntry
    $objSearcher = New-Object System.DirectoryServices.DirectorySearcher
    $objSearcher.SearchRoot = $objDomain
    $objSearcher.PageSize = 1000
    $objSearcher.Filter = $strFilter
    $objSearcher.SearchScope = "Subtree"
    $colProplist = "samaccountname"
    foreach ($i in $colPropList){$objSearcher.PropertiesToLoad.Add($i)}
    $colResults = $objSearcher.FindAll()
    foreach ($objResult in $colResults)
    $objItem = $objResult.Properties; $objItem.samaccountname
    $listTemplate = [Microsoft.SharePoint.SPListTemplateType]::DocumentLibrary
    $listId = $siteweb.Lists.Add($objItem.samaccountname, "", $listtemplate);
    $list = $siteweb.Lists.GetList($listId, $true);
    $roleDef = $siteweb.RoleDefinitions.GetByType("Contributor");
    $user = "domain\" + $objItem.samaccountname;
    $rolAssign = new-object Microsoft.SharePoint.SPRoleAssignment($user, "email", "name", "notes");
    $rolAssign.RoleDefinitionBindings.Add($roleDef);
    if(!$list.HasUniqueRoleAssignments)
    {$list.BreakRoleInheritance($true);}
    for ($i = $list.roleAssignments.Count - 1; $i -gt -1; $i--)
    { $list.RoleAssignments.Remove($i) }
    $list.RoleAssignments.Add($rolAssign);
    $list.Update();
    Now I have a custom Document Library named "TESTLIB" so if I substitute the line:
    $listTemplate = [Microsoft.SharePoint.SPListTemplateType]::DocumentLibrary
    with
    $listTemplate = [Microsoft.SharePoint.SPListTemplateType]::TESTLIB
    Then it errors with this...
    How can I script powershell to create a "custom" Document Library?
    Thanks

    The below link should help you in creating custom document library using powershell
    http://blogs.technet.com/b/heyscriptingguy/archive/2010/09/23/use-powershell-cmdlets-to-manage-sharepoint-document-libraries.aspx
    Vinod H
    Thanks for the link but I cant see anything to assist creating a custom library?  Was there something in paticular you saw?

  • How to export Powershell script information to Sharepoint?

    I'm trying to export information gather from a Powershell script to a Sharepoint list. I've got a couple of powershell scripts that gather general server information from a server ex: server uptime, disk space, service tag, etc. and it will export the information
    to a csv file. What I would like to do is out-put the same information gathered by the powershell scripts to a Sharepoint list directly if at all possible.
    Ex:
    # all this does is reads from a list and runs a script call "boottime.ps1"
    get-content "\\%Data-Path-Of-List%\computers.txt" | %Data-Path-Of-Script%\boottime.ps1 |  Export-csv %Data-Path-For-CSV\Computers.csv
    # then just exports the information from the boottime.ps1 script to a csv file
    #I also have a script that will upload the information to a sharepoint list.
    # I found that I have to run this in version 2 of powershell, so I just open a DOS prompt in Admin Priv's and type the following
    powershell.exe -version 2.0
    # Next I make sure the Sharepoint snap-in is loaded
    if ( (Get-PSSnapin -Name Microsoft.sharepoint.powershell - erroraction silentlycontinue) -eq $null)
    Add-PsSnapin Microsoft.Sharepoint.Powershell
    $spweb = get-SPweb $spserver
    $spdata =$spweb.getlist("%URL_Of_My_List%")
    # this is the same location from the orginal Powershell script previously stated.
    $ComputerInfoFile = "%Data-Path-For-CSV%\Computers.csv"
    foreach ($rows in $tblData) {
    # here is where I add the information from my csv file
    # 2 things needs to be present
    # 1st the colums have to be present in the sharepoint site before I can upload the information
    # 2nd the columns have to the headers in my csv file
    $spItem = $spData.AddItem()
    $SpItem["ServerName"] = $row."ServerName".toString()
    $SpItem["Uptime"] = $row."Uptime".toString()
    $SpItem.Update()
    # this just disconnects from Sharepoint
    $spWeb.Dispose()
    Please dismiss all the comments it just helps me understand what the code is doing, also if this is not the correct place to post this question I appologize in adavance and ask that if this is the incorrect place to post this question please provide me a
    link to a where I can post such questions.

    Sorry for the delay in posting this, but I ended up getting working. I'll post it in the hopes that my head scratching will save someone else some head scratching:
    I ended up writting 3 PS scripts and one batch job.
    1st Batch file
    powershell.exe -version 2.0 -command
    \\%Script-Location\Get-Server-Infor-4-SP.ps1
    powershell.exe -version 2.0 -command \\%Script-Location\Delete-list-Items.ps1"
    powershell -veriosn 2.0 -command
    \\%Script-Location\Populate-SP.ps1
    1st PS script that gets the info:
    get-content
    \\%Location-Of-My-File-With-List-Of-Servers%\%name-of-file%.txt |
    \\%Location-Of-My-Script-To-get-the-Information-I-want | Export-csv
    \\%location-of-my-output\%filename%.csv
    Ex: get-content C:\scripts\computers.txt | C:\scripts\boottime.ps1 | export-csv C:\scripts\computer.csv
    2nd PS script Delete-List-Items.ps1
    # http:
    #Script 1 Boottime.ps1:
    # This script permits to get UpTime from localHost or a set of remote Computer
    # usage
    # localHost
    # .\BootTime.ps1
    # set of remote computers
    # get-content .\MyserverList.txt | .\boottime.ps1
    # Optionally pipe output to Export-Csv, ConverTo-Html
    Process {
    $ServerName = $_
    if ($serverName -eq $Null) {
    $serverName= $env:COMPUTERNAME
    $timeVal = (Get-WmiObject -ComputerName $ServerName -Query "SELECT LastBootUpTime FROM Win32_OperatingSystem").LastBootUpTime
    #$timeVal
    $DbPoint = [char]58
    $Years = $timeVal.substring(0,4)
    $Months = $timeVal.substring(4,2)
    $Days = $timeVal.substring(6,2)
    $Hours = $timeVal.substring(8,2)
    $Mins = $timeVal.substring(10,2)
    $Secondes = $timeVal.substring(12,2)
    $dayDiff = New-TimeSpan $(Get-Date –month $Months -day $Days -year $Years -hour $Hours -minute $Mins -Second $Secondes) $(Get-Date)
    $Info = "" | select ServerName, Uptime
    $Info.servername = $servername
    $d =$dayDiff.days
    $h =$dayDiff.hours
    $m =$dayDiff.Minutes
    $s = $daydiff.Seconds
    $info.Uptime = "$d Days $h Hours $m Min $s Sec"
    $Info
    #Script 2: Delete-List-Items.ps1
    # http://markimarta.com/sharepoint/delete-all-items-in-sharepoint-list-using-powershell/
    # there seems to be a problem with running this script in version 3 or later, the workaround is to run it in version 2
    # below is the cmd for doing so, just open up a DOS prompt with Admin Privileges Start-->Run-->cmd
    # type then copy and paste the following line the DOS window then you can run this script
    #powershell.exe -version 2.0
    # make sure that the Microsoft.SharePoint.PowerShell Snap-in is installed as well
    if ( (Get-PSSnapin -Name Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue) -eq $null )
    Add-PsSnapin Microsoft.SharePoint.PowerShell
    # "Enter the site URL instead http://serverurl"
    $SITEURL = "%http://serverurl%"
    $site = new-object Microsoft.SharePoint.SPSite ( $SITEURL )
    $web = $site.OpenWeb()
    "Web is : " + $web.Title
    # Enter name of the List below in the [“%List-Name%”]
    $oList = $web.Lists["%List-Name%"];
    # This echo out the name of the list its going to be deleting the records from
    "List is :" + $oList.Title + " with item count " + $oList.ItemCount
    # It’s just counting the rows/records
    $collListItems = $oList.Items;
    $count = $collListItems.Count - 1
    # Here is where it is actually deleting the records and then out put the number or the record it deleted
    for($intIndex = $count; $intIndex -gt -1; $intIndex--)
    "Deleting record: " + $intIndex
    $collListItems.Delete($intIndex);
    #Script 3: Populate-SP_Test.ps1
    # http://blogs.technet.com/b/stuffstevesays/archive/2013/07/10/3577320.aspx
    # there seems to be a problem with running this script in version 3 or later, the workaround is to run it in veriosn 2
    # below is the cmd for doing so, just open up a DOS prompt with Admin Privileges Start-->Run-->cmd
    # type then copy and paste the following line the the DOS window then you can run this script
    #powershell.exe -version 2.0
    # make sure that the Microsoft.SharePoint.PowerShell Snap-in is installed
    if ( (Get-PSSnapin -Name Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue) -eq $null )
    Add-PsSnapin Microsoft.SharePoint.PowerShell
    # Here are some more varables that can be added I was not able to get this to work
    #$SPComputerInfo="/Lists/PowershellTest/"
    # Here is where we connect and Open SharePoint List via Powershell
    $SPServer= "%http://serverurl%
    $spWeb = Get-SPWeb $SPServer
    $spData = $spWeb.GetList("%List-Name%")
    # This is the variable for the path that has the file I want to input to SharePoint List
    $InvFile="\\%location-ofList%\computers.csv"
    # This is just some error checking to make sure the file exist
    $FileExists = (Test-Path $InvFile -PathType Leaf)
    if ($FileExists) {
    "Loading $InvFile for processing..."
    $tblData = import-csv $InvFile
    } else {
    "$InvFile not found - stopping import!"
    exit
    # Loop through Applications add each one to SharePoint
    "Uploading data to SharePoint...."
    foreach ($row in $tblData) {
    #Here is where I add the information from my CSV file
    #2 things have to be present
    # 1. the columns have to be in the sharepoint site before I can import the information
    # 2. columns have to the headers in my csv file
    #"Adding entry for "+$row."Computer Information".ToString()
    $spItem = $spData.AddItem()
    $spItem["ServerName"] = $row."ServerName".ToString()
    $spItem["Uptime"] = $row."Uptime".ToString()
    #$spItem["DNSHostName"] = $row."DNSHostName".ToString()
    #$spItem["DistinguishedName"] = $row."DistinguishedName".ToString()
    $spItem.Update()
    # This is just disconnecting from SharePoint
    $spWeb.Dispose()
    Enjoy, and if anyone has a better way of doing this I'm interested in knowing, thanks again
    Thanks in Adavance

  • PowerShell script to list ALL documents bigger than 10MB - in list attachments/libraries all over my site?

    Hi there,
    Just wondering if someone can give me the PowerShell script to list ALL documents bigger than 10MB - in list attachments/libraries all over my site?
    Really appreciated.
    Thank you.

    Hello,
    here you can find sample to help you create yoru script :
    http://sharepointpromag.com/sharepoint/windows-powershell-scripts-sharepoint-info-files-pagesweb-parts
    see this sample extract from this site
    Get-SPWeb http://sharepoint/sites/training |
                                     Select -ExpandProperty Lists |
                                     Where { $_.GetType().Name -eq "SPDocumentLibrary" -and
                                             -not $_.Hidden }
    |
                                     Select -ExpandProperty Items |
                                     Where { $_.File.Length -gt 5000 } |
                                     Select Name, {$_.File.Length},
                                            @{Name="URL";
                                            Expression={$_.ParentList.ParentWeb.Url
    + "/" + $_.Url}}
    this can help too :
    https://gallery.technet.microsoft.com/office/Get-detail-report-of-all-b29ea8e2
    Best regards, Christopher.
    Blog |
    Mail
    Please remember to click "Mark As Answer" if a post solves your problem or
    "Vote As Helpful" if it was useful.
    Why mark as answer?

  • Saving scheduled report in a Sharepoint document library

    I am trying to schedule a crystal report through Infoview and I want the resulting report saved in a Sharepoint document library. Is this possible? I am using BOE 11.5

    Hi Maureen;
    it is not possible...Because sharepoint document library is a virtual directory.You only save your files to real directories.
    You must use SharePoint Integration Kit.

  • Delivery Error when creating Sharepoint Document Library subscription

    Recently we have been having issue with a subscription from a report we have.
    We have a report that has been generated and have a subscription from that report to create a PDF document within sharepoint.
    Recently the subscription stopped working and we have these errors showing:
    A delivery error has occurred. ---> Microsoft.ReportingServices.Diagnostics.Utilities.DeliveryErrorException: A delivery error has occurred. ---> Microsoft.ReportingServices.Diagnostics.Utilities.InvalidExtensionParameter: One of the extension parameters
    is not valid for the following reason: Failed to validate the delivery setting PATH.The specified user USERNAME could not be found.
          Failed to validate the delivery setting PATH.The specified user USERNAME could not be found
    Looking into this, I found a few things but they did not help.
    One thing was to install update 5 for SQL server 2012 R2, but that didn't help.
    Another thing was saying something about there being 2 user accounts, a claims account and a windows user account, but I couldn't figure out how to make it use the correct account.
    I also tried to save it to a Windows File Share, and try to save it to the Sharepoint server side, however that failed stating it couldn't find that path.
    Being that sharepoint is tricky with its file store (is there really a location on the server that files are stored, I cant find it) I could not figure it out.
    I know I can windows explorer to the file location, \\site\shared documents\Folder but if I go to the web servers that host sharepoint I can't find where this path really is.
    Thanks

    Hi,
    According to your post, my understanding is that you want to get error in accessing sharepoint document library files.
    The cause is that the account being used to validate accounts on the production domain had been set to expire the password according to the general domain policy.
    Once the account is set to never expire, the issues will disappear.
    For more information, you can refer to:
    http://kb4sp.wordpress.com/2012/12/05/user-cannot-be-found-shenanigans-one-way-active-directory-trusts-and-sharepoint-2013/
    http://blogs.msdn.com/b/cliffgreen/archive/2013/02/19/sharepoint-2013-the-directory-is-not-a-subdirectory-of-the-root-directory.aspx
    Best Regards,
    Linda Li
    Linda Li
    TechNet Community Support

  • Files Uploaded using Mapped Drive (UNC) to SharePoint Document library Putting a copy in Recycle Bin , odd SharePoint Behaviour

    Hello All,
    One of my client reported a strange behaviour.
    Client mapped SharePoint document library to local share(UNC, NetWork Map Drive). Opened MS Word on local machine ,saved it to the share on his local machine. The document is saved successfully to SharePoint document library. But at the same time he can
    see a file with same name in Recycle bin and the size of the document in Recycle bin is <1k.
    Does any one know whether it is expected behaviour, why SharePoint putting this 1k file in Recycle bin?
    I tried the same thing on my Dev Environment for both SharePoint 2010 and 2013, in both environments the behaviour is same as my client experience.
    I have seen in forums some other people also experiencing this odd behaviour, but no one knows why.
    any info on this much appreciated.
    Regards,
    Andrew

    Hi Andrew,
    i tried in my environment for 2010 and 2013. The issue doesn't occur.
    Here is what i did.
    1, Create a new mapped drive(\\servername\DavWWWRoot\Shared Documents) for document library
    2, New a Word doc and input some string, save in the mapped drive.
    3, The doc exists in the document library, but no file in Recycle Bin.
    Did i miss something?
    Regards,
    Tom
    Microsoft Online Community Support
    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to
    other community members reading the thread.

  • SharePoint Document Library

    Hi,
    I have a scenario, where I need to upload files from a Unix system to SharePoint document library. How can this be achieved using SharePoint Web Services (REST endpoint or any other endpoint that can be consumed in other scripting technologies) and not the
    SharePoint object model? 
    Thanks,

    Hi,
    According to your post, my understanding is that you want to upload the files from the Unix system to SharePoint document library.
    We can install  File Transfer Protocol (FTP) in Unix system. In a client machine, we can create a Console Application using Visual Studio, then use C# to get the
    file in FTP server, then add the files to SharePoint document library using SharePoint Client Object Model or REST APIs.
    If you need to scheduled uploading, we can create a Windows Job to achieve it.
    The following articles for your reference:
    http://kumarprashanth.blogspot.com/2010/06/reading-unix-file-using-cnet.html
    http://blogs.msdn.com/b/sridhara/archive/2010/03/12/uploading-files-using-client-object-model-in-sharepoint-2010.aspx
    Best regards
    Dennis Guo
    TechNet Community Support

  • Create a new document in Sharepoint Document Library/OneDrive on iPad/Safari

    Hi,
    My users are having trouble creating a new document from OneDrive in Safari on their iPads. The screen goes grey like its going to show the popup to select the new file type, but the popup never comes up. If they clear their cache, it works for exactly 1
    time and then goes back to this behavior. I'm not exactly sure if it worked before and/or when it stopped working. The iPad I have tested was at the latest 8.2 version of IOS and my Sharepoint farm is an On-Prem install of 2013 with SP1 mark2. My WAC farm
    is also 2013 SP1.
    Any suggestions?
    Thanks,
    Matt

    Hi,
    I understand you are suffering the issue when create a document in Sharepoint Document Library/OneDrive on  iPad.
    According to the official article
    https://technet.microsoft.com/en-us/library/fp161353.aspx?f=255&MSPPError=-2147217396, the version of your iOS should be in the supported list. I guess the issue may start after you installed an update, and if there is any other version (low versions)
    of iPads in your company, please use a different version device to test the issue.
    Meanwhile, to determine whether the issue is related to your SharePoint environment, I suggest you just to register an Office 365 trail account, and test the issue with SharePoint Online. In case the same issue happens with SharePoint Online, the issue should
    be related to your client device, and my next suggestion is to contact support of your device manufacture.
    Once you need any help from SharePoint end, please don’t hesitate to come back, and we are always happy to support you.
    Best Regards,
    Lisa Chen
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • Not able to create sub folder using SharePoint web service in large SharePoint document library (Item count view threshold limit)

    We are trying to create folder & subfolder in a SharePoint document library using SharePoint default(dws) web service. Document library has unique permission as well as item level permission. It was working as expected. Once item count crosses
    view threshold limit ( 5000) , create folder web method completes with an error and it creates a folder in SharePoint.
    Request:
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:dws="http://schemas.microsoft.com/sharepoint/soap/dws/">
       <soapenv:Header/>
       <soapenv:Body>
          <dws:CreateFolder>
             <!--Optional:-->
             <dws:url>Shared Documents/VenTest02092015v1</dws:url>
          </dws:CreateFolder>
       </soapenv:Body>
    </soapenv:Envelope>
     Response:
    <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
       <soap:Body>
          <CreateFolderResponse xmlns="http://schemas.microsoft.com/sharepoint/soap/dws/">
             <CreateFolderResult>&lt;Error ID="2">Failed&lt;/Error></CreateFolderResult>
          </CreateFolderResponse>
       </soap:Body>
    </soap:Envelope>
     While trying to create subfolder under the above created folder service throws an exception saying
    FolderNotFound.
    Though we are able to create subfolder from SharePoint UI successfully. 
    Request
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:dws="http://schemas.microsoft.com/sharepoint/soap/dws/">
       <soapenv:Header/>
       <soapenv:Body>
          <dws:CreateFolder>
             <!--Optional:-->
             <dws:url>Shared Documents/VenTest02092015v1/REQ-1</dws:url>
          </dws:CreateFolder>
       </soapenv:Body>
    </soapenv:Envelope>
    Response:
    <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
       <soap:Body>
          <CreateFolderResponse xmlns="http://schemas.microsoft.com/sharepoint/soap/dws/">
             <CreateFolderResult>&lt;Error ID="10">FolderNotFound&lt;/Error></CreateFolderResult>
          </CreateFolderResponse>
       </soap:Body>
    </soap:Envelope>

    Yes, you're probably hitting the 5000 list item threshold (
    http://sharepoint.stackexchange.com/questions/105937/overcoming-5000-file-document-library-limits ). I assume you can do it via the UI because you're probably logged in as an admin in which case, out of memory, the threshold is 20.000 items. You can extend
    this limit, but you probably shouldn't.
    Kind regards,
    Margriet Bruggeman
    Lois & Clark IT Services
    web site: http://www.loisandclark.eu
    blog: http://www.sharepointdragons.com

  • Ssrs sharepoint 2013 error: "A delivery error has occurred ...not a sharepoint document library..."

    Greetings SSRS/SharePoint experts,
    SharePoint 2013 with SSRS - Creating a subscription to a report that is in SharePoint
    I'm trying to create a subscription to publish a report to a sharepoint document library.
    I've configured all the settings and on clicking OK get the following error:
    "A delivery error has occurred. ---> Microsoft.ReportingSerives.Diagnostics.Utilities.DeliveryErrorException: A delivery error has occurred. ---> Microsoft.ReportingServices.Diagnostics.Utilities.InvalidExtensionParameter: One of the extension
    parameters is not valid for the following reason: The delivery path is either not a SharePoint Document Library Folder or does not exist in the Share Point farm."
    SQL Server Developer Edition 2012 SP1
    SharePoint 2013 Standard
    Just wondering if anyone has a solution.
    I've tried changing the proxy settings as per this post
    http://social.technet.microsoft.com/Forums/en-US/19817dc7-6725-40d8-befa-1b94099a71bd/sql-server-2012-reporting-services-in-sharepoint-2013-integrated-mode-dilivery-extension
    Workaround is to not use a sharepoint document library but write the report to a windows file share (this works but is not optimal).
    Hoping someone at Microsoft or an expert will come back with something.
    Kind regards
    Gio

    Hi,
    Can you check the SharePoint ULS log located at : C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\LOGS, and look at the log there when the error occurs?
    You can also check the Application Event Log on the SQL Server to see if there are any additional errors.
    Tracy Cai
    TechNet Community Support

  • Download older version of a file from SharePoint Document Library using CSOM and 404 error

    Hi,
    I am trying to download previous versions including Major and Minor versions of documents from SharePoint Online using CSOM. I get 404 error when I try to download the file. I found several posts on various discussion forums where people are getting same
    error but none of those have any solution/answer. Below is one of the threads and sample code I have tried that results in 404 error. If I use the link in browser directly, I am able to download the file. Also I am able to download the current version of file
    using CSOM without any problem, it is only the older versions that give me 404 in CSOM.
    http://qandasys.info/how-to-download-the-historical-file-version-content-using-csom/
    public int GetStreamFromFile(string docid, string lib, string fileurl, ClientContext clientContext, int iuserid, string Version, bool isCurrrent)
    if(!isCurrent)
    List LibraryName = clientContext.Web.Lists.GetByTitle(lib);
    clientContext.Load(LibraryName);
    clientContext.ExecuteQuery();
    CamlQuery camlQuery = new CamlQuery();
    camlQuery.ViewXml = "" + fileurl +
    Microsoft.SharePoint.Client.ListItemCollection collListItem = LibraryName.GetItems(camlQuery);
    clientContext.Load(collListItem, items => items.Include(item => item.Id, item => item["FileLeafRef"], item => item["LinkFilename"],
    item => item["FileRef"], item => item["File_x0020_Size"], item => item["DocIcon"], item => item.File.Versions));
    //clientContext.Load(collListItem);
    clientContext.ExecuteQuery();
    foreach (Microsoft.SharePoint.Client.ListItem oListItem in collListItem)
    //string fileurl1 = (string)oListItem["FileRef"];
    //string filename = (string)oListItem["LinkFilename"];
    foreach (FileVersion version in oListItem.File.Versions)
    if (Version == version.VersionLabel)
    //Added excutequery to get object one more time as per blog
    //http://social.technet.microsoft.com/Forums/de-DE/sharepointdevelopmentprevious/thread/88a05256-8694-4e40-863d-6c77512e079b
    clientContext.ExecuteQuery();
    FileInformation fileInformation = ClientOM.File.OpenBinaryDirect(clientContext,version.Url);
    bytesarr = ReadFully(fileInformation.Stream);
    Darwaish

    Hi,
    According to your description,
    I know you want to get older version of a file from SharePoint Document Library using Client Object Model.
    The following code snippet for your reference:
    public void GetVersions()
    ClientContext clientContext = new ClientContext(“http://SPSite”);
    Web site = clientContext.Web;
    clientContext.Load(site);
    clientContext.ExecuteQuery();
    File file = site.GetFileByServerRelativeUrl(“/Shared Documents/mydocument.doc”);
    clientContext.Load(file);
    clientContext.ExecuteQuery();
    ListItem currentItem = file.ListItemAllFields;
    clientContext.Load(currentItem);
    clientContext.ExecuteQuery();
    FileVersionCollection versions = file.Versions;
    clientContext.Load(versions);
    clientContext.ExecuteQuery();
    if (versions != null)
    foreach(FileVersion _version in versions)
    Console.WriteLine(“Version : {0}”,_version.VersionLabel);
    More information:
    http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.client.file.versions.aspx
    Best Regards,
    Dennis Guo

  • Advice needed for provider hosted web application - authentication and access to SharePoint document library

    I haven't done SharePoint 2013 development with claims so I apologize in advance if my assumptions and questions are way out in left field.
    I'm trying to understand SharePoint 2013 claims authentication for a scenario that involves:
    A SharePoint provided hosted (web forms) app that will pull information and assets (e.g. PDFs) from SharePoint into the web page.
    It will be a VS 2012 solution with asp.net.identity feature.
    Security will be set for internal users, federated external users and forms-based external users.  Based on their security and (claim type) role it will define what information and assets that can be retrieved from SharePoint
    I have looked through MSDN and other sources to understand.
    This one helped with my understanding 
    Federated Identity for Web Applications and assumed that the general concept could be applied to forms-based identity for non-Federated external users .
    What I have now:
    VS 2012 solution web forms application set to Provider Host with asp.net.identity feature and its required membership tables.
    I can create new users and associate claims to the new user.
    I can log in with a user from the membership tables and it will take me to a default.aspx page.  I have added code to it that displays the claims associated to a user.
    For POC purposes I'd like to retrieve documents that are associated to this user from the default.aspx page.
    This is where I am having trouble understanding:  Is my understand correct?
    Internal users
    since they are internal on the network i am assuming that they would already have access to SharePoint and they would already be configured to what documents that they have available to them.
    Federated external users & Forms authentication external users
    it seems to me that the authentication for external users are separate from SharePoint authentication process.
    changes to the configuration settings are necessary in SharePoint, IIS, web application.
    I believe this is what i read.
    claims processes (e.g. mappings) need to be set up in SharePoint
    as long as external users are authenticated then things are ok b/c they would have claims associated to the user and the configuration in SharePoint takes are of the rest.
    This statement bothers me because I think it's wrong.
    So basically i'm stuck with if my understanding is correct: once a user is authenticated either by federated identity or asp.net.identity authentication that it should go to the provider hosted default.aspx page because the claim is authenticated and means
    that it should have access to it and the SharePoint document library based on some claim property.  I could then write the calls to retrieve from a document library and SharePoint will know based on some claim property that the logged in user can only
    access certain documents.
    It just sounds too good to be true and that i'm missing something in the thought process.
    Thanks in advance for taking the time to read.
    greenwasabi

    Hi GreenWasabi,
    i agree this is an interesting topic to discuss,
    as you can check from the article, you may check this example from the codeplex:http://claimsid.codeplex.com/
    when i thinking regarding this topic, its looks like an environment with multiple of realms,
    from what you understand, its correct that all the authentication is based from the provider, so for example i have a windows live ID and internal ID, then when i login windows live ID, it will be authenticated using windows live ID server.
    here is the example for the webservice:
    http://claimsid.codeplex.com/wikipage?title=Federated%20Identity%20for%20Web%20Services&referringTitle=Home
    as i know, if you using this federated, i am not quite sure that you will need to go to the provider page literally, perhaps you can check this example if we are using azure:
    http://social.technet.microsoft.com/wiki/contents/articles/22309.integrating-windows-live-id-google-and-facebook-accounts-with-sharepoint-2013-white-paper.aspx
    Regards,
    Aries
    Microsoft Online Community Support
    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

  • Linking a programmatically created folder in SharePoint Document Library.

    I have created folders within a document library using InfoPath & C#. To that folder I uploaded several documents using several file attachment controls within the same InfoPath Form using the code behind the form.  Now I want to create an Hyperlink
    to each folder in another document folder's column that has the relationship with the previously created folder.
    When I googled I saw there are lot of articles to create Folders ,uploading documents to folders in a SharePoint Library but I cannot understand how to create a hyperlink in a SharePoint Document Library field column.
    Could someone help me to solve this matter?
    Thanks,
    Regards,
    Chiranthaka

    Why don’t you create a hyperlink column to store the hyperlink value, or you can use a lookup column to lookup the related folder item?
    Qiao Wei
    TechNet Community Support

  • Word opening in Client Application in SharePoint document library when feature is not activated in manage features in site collection

    Hello, I wish for all Word documents to open in the browser for my SharePoint document library on my team site.
    The feature 'open in client application' is not activated in Features for the site collection and the setting in the document library is set on 'Use the server default (open in the browser)
    When I select File > new> from the ribbon in the document library - it still opens Word in the client application?
    Any ideas on this?
    Is there a general Office 365 setting over riding SharePoint somewhere?
    Regards
    kegan1

    Okie don't open up a ticket. Can you please open internet explorer...See if its the latest version. Once you have done that can you login to the SharePoint site. Then go to the internet wheel option  in top right corner > select manage add on >
    Click on toolbars and extensions on left > then click on SharePoint open documents in client and disable it. Close the browser completely now for the changes to take effect. Open internet explorer once again and then try to go to site collection click on
    file and create new. The word will open up in browser now. This has to be done on each and every machine in your firm so that users will be able to open up only in browser. Out of the box there is only one way is to customize the ribbon and remove the new
    option from there or creating an all together new ribbon for your SharePoint from visual studio.

Maybe you are looking for