Working with Document Libraries in .NET framework

Make QR Code in .NET framework Working with Document Libraries

Working with Document Libraries
Quick Response Code Reader In Visual Studio .NET
Using Barcode Control SDK for .NET framework Control to generate, create, read, scan barcode image in Visual Studio .NET applications.
Denso QR Bar Code Printer In Visual Studio .NET
Using Barcode maker for .NET Control to generate, create QR image in Visual Studio .NET applications.
Working with document libraries is similar to working with SharePoint lists, as described in the preceding chapters To demonstrate, we ll create a new document library and then show how to add items to document libraries
Decode QR In .NET Framework
Using Barcode reader for .NET framework Control to read, scan read, scan image in .NET framework applications.
Barcode Generator In .NET Framework
Using Barcode printer for VS .NET Control to generate, create barcode image in Visual Studio .NET applications.
Creating Document Libraries
Barcode Recognizer In .NET Framework
Using Barcode scanner for .NET framework Control to read, scan read, scan image in VS .NET applications.
Creating QR Code JIS X 0510 In C#
Using Barcode maker for Visual Studio .NET Control to generate, create QR image in VS .NET applications.
Creating a new document library using Windows PowerShell is similar to creating any other type of list You can use the same Add method provided by the SPListCollection class This example demonstrates how to create a document library using the New-SPList function described in 14
Create QR-Code In .NET Framework
Using Barcode printer for ASP.NET Control to generate, create QR Code 2d barcode image in ASP.NET applications.
QR Code ISO/IEC18004 Creation In VB.NET
Using Barcode drawer for .NET framework Control to generate, create Quick Response Code image in .NET framework applications.
PS > New-SPList -url http://nimaintranet/Site -name "My Docs" ` >> -description "My Document Library" -template DocumentLibrary
ECC200 Encoder In VS .NET
Using Barcode generator for VS .NET Control to generate, create Data Matrix ECC200 image in Visual Studio .NET applications.
Printing GTIN - 128 In VS .NET
Using Barcode generator for .NET Control to generate, create GS1-128 image in .NET framework applications.
To retrieve a library in SharePoint 2010, use the Get-SPList function, just as when retrieving lists
Paint Matrix 2D Barcode In .NET
Using Barcode creator for Visual Studio .NET Control to generate, create Matrix 2D Barcode image in VS .NET applications.
Making Code 93 Extended In VS .NET
Using Barcode maker for VS .NET Control to generate, create Uniform Symbology Specification Code 93 image in Visual Studio .NET applications.
PS > $spDocumentLibrary = Get-SPList -url "http://nimaintranet/Site/My Docs"
Painting Data Matrix In None
Using Barcode generator for Microsoft Excel Control to generate, create Data Matrix ECC200 image in Excel applications.
Make EAN-13 Supplement 5 In Visual Basic .NET
Using Barcode creation for Visual Studio .NET Control to generate, create GTIN - 13 image in .NET framework applications.
16:
Barcode Creator In None
Using Barcode drawer for Software Control to generate, create barcode image in Software applications.
Barcode Creation In .NET
Using Barcode maker for ASP.NET Control to generate, create barcode image in ASP.NET applications.
Managing Documents in Document Libraries
Make Data Matrix ECC200 In VS .NET
Using Barcode generator for Reporting Service Control to generate, create DataMatrix image in Reporting Service applications.
Create Bar Code In None
Using Barcode encoder for Software Control to generate, create barcode image in Software applications.
Document libraries in SharePoint 2010 inherit many properties and methods from the SPList class, but also include specific properties and methods available only for document libraries For instance, to check if a document library is a gallery, such as Site Templates, List Templates, Web Parts, or Master Pages, use the IsCatalog property of the SPDocumentLibrary class
Painting Code39 In None
Using Barcode generation for Microsoft Word Control to generate, create Code 39 Full ASCII image in Microsoft Word applications.
Code 128 Decoder In C#
Using Barcode recognizer for Visual Studio .NET Control to read, scan read, scan image in .NET framework applications.
PS > $spDocumentLibraryIsCatalog False
Here, the property returned False because the document library is not a gallery You can use the IsCatalog property if you are looping through a collection of document libraries and want to exclude galleries In the next example, we use the GetListsOfType method to retrieve a collection of all document libraries in a site, and then we use the Where-Object cmdlet to pick out only the document libraries where the IsCatalog property is not equal to True Finally, we use the ForEach-Object cmdlet and perform an action on each of the document libraries
PS PS >> >> > $spWeb = Get-SPWeb -Identity http://nimaintranet/Site > $spWebGetListsOfType("DocumentLibrary") | Where-Object { $_IsCatalog -ne $true } | ForEach-Object { Write-Host $_Title }
There are other useful properties that can be set when creating or updating a document library, such as versioning settings, which we will discuss in the next chapter SharePoint document libraries may have folders to better organize the contents of the library These folders can be created using the same AddItem method used for adding new list items The difference is that you use another overload definition of this method, which also accepts a value of type MicrosoftSharePoint SPFileSystemObjectType that instructs it whether the new item is a file or a folder
PS > $spFolder = $spDocumentLibraryAddItem( >> "",[MicrosoftSharePointSPFileSystemObjectType]::Folder,"My New Folder")
PS > $spFolderUpdate()
The ability to create folders can be enabled or disabled from the graphical user interface This setting can also be modified by Windows PowerShell through the EnableFolderCreation property
PS > $spDocumentLibraryEnableFolderCreation = $false PS > $spDocumentLibraryUpdate()
NOTE Even if the EnableFolderCreation property is set to False, you can still create folders using the SharePoint object model, such as with Windows PowerShell
PowerShell for Microsoft SharePoint 2010 Administrators
To remove a document library, use the Delete method again, just as with lists
PS > $spDocumentLibraryDelete()
Uploading and Managing Files
To upload files to a SharePoint document library, use the Add method provided by the MicrosoftSharePointSPFileCollection class, which represents a collection of SPFile objects in SharePoint 2010 Before you can access a file collection in SharePoint 2010, you must create an instance of the MicrosoftSharePointSPFolder class using the GetFolder method provided by the MicrosoftSharePointSPWeb class This example demonstrates how to use the GetFolder method on the Shared Documents document library
PS > $spWeb = Get-SPWeb -Identity http://nimaintranet/Site PS > $spFolder = $spWebGetFolder("Shared Documents")
Once you have bound to the document library, you can store the file collection in a new variable, which you can later use to add files, as follows:
PS > $spFileCollection = $spFolderFiles
The Add method provided by the MicrosoftSharePointSPFileCollection class is used to create a file in a file collection This is very versatile method that has 21 overload definitions For the one that we will be using in our example, we need to specify the file s relative URL, a byte array containing the file, and a Boolean value that determines whether an existing file with the same name should be overwritten Let s take a look at the byte array first It is possible to expose a sequence of bytes using the SystemIOFileStream class, which we can pass on to the Add method A simple way of retrieving an object of the type SystemIOFileStream is by using the OpenRead method provided by the SystemIOFileInfo class When using the Get-ChildItem cmdlet on a file, we get an object of the type SystemIOFileInfo, as shown here:
Copyright © OnBarcode.com . All rights reserved.