Showing posts with label SharePoint 2010. Show all posts
Showing posts with label SharePoint 2010. Show all posts

Intro

If you are a SharePoint Developer or Administrator you know it can take a long time to deploy SharePoint 2010 and difficult to remember everything that you have to configure in SharePoint 2010. A easy deployment solution is available to quickly deploy SharePoint 2010.

The Solution

The easy deployment solution is the CodePlex project namely AutoSPInstaller. This project use the power of PowerShell to automate deployment and configuration of SharePoint 2010. The PowerShell scripts allows you to deploy SharePoint 2010 with prerequisites, service packs and updates, Forefront Security, Language Packs, Office Web Apps and PDF iFilter with icon.

For a detailed guide to use the AutoSPInstaller scripts go to Tobias Lekman post: http://blog.lekman.com/2010/11/automated-sharepoint-2010-installations.html

These scripts allow you to configure SharePoint 2010 once according to your requirements and use it over and over again.

Developer Setup

What about a basic SharePoint 2010 setup for development? Well, Microsoft created a easy setup script to setup the following on a machine or VM:

  • SharePoint Server 2010 + Pre-requisites (Standalone)
  • Visual Studio 2010 Ultimate Edition
  • Silverlight 4 Tools for Visual Studio
  • Expression Studio 4 Ultimate
  • Open XML SDK
  • Visual Studio SDK
  • Visual Studio SharePoint Power Tools
  • Office 2010 Professional Plus
  • SharePoint Designer 2010
  • Visio 2010

The download location for SharePoint 2010 Easy Setup Script: http://www.microsoft.com/download/en/details.aspx?id=23415

Hope these scripts make your life easier as a SharePoint 2010 Developer and Administrator.

Cheerio!

I had a very interesting experience try to setup Lync Server 2010 for my latest project. Using Lync Server 2010 with SharePoint 2010 environment. Very powerful combination for user collaboration.

Anyway, I got a very strange error in publishing my Lync Topology:

The existing topology identifies serverA.domain as the Central Management Store, but the topology that you are trying to publish identifies serverB.domain as the Central Management Store. The Central Management Stores must match before the topology can be published.

The white blotches on the images are server FQDN that I needed to hide.

Deployment Error

The reason for this might be that you specified the wrong FQDN and try to publish the Lync topology before. Firstly make sure you use the correct FQDN for the server that is hosting the Central Management Store.

Open up Lync Server Management Shell and type the following command to get the currently registered Central Management Store location:

Get-CsConfigurationStoreLocation

Command Get Store

To remove the registered Central Management Store location type in the following command:

Remove-CsConfigurationStoreLocation

Command Remove Store

After running these commands you can attempt to publish your Lync Topology again and see the success message.

Publish Success

Hope this help you with fixing Lync Topology publishing problems.

Cheerio!

Today I’m going to show you how to upload documents to a document library in SharePoint 2010 and also to create folders via web services in the document library.

I configured a document library where I want to create folders and store documents. I named it “My Documents Library” located at “http://server/sites/personal/My Documents Library”

Let’s Create Folders

In your .Net project you have to add a service reference to http://server/sites/personal/_vti_bin/Dws.asmx. This is the Document Workspace service.

Here is the code to create a folder in the document library:

  1: // Title of Document Library
  2: string library = "My Documents Library";
  3: 
  4: DwsSoapClient client = new DwsSoapClient();
  5: if (client.ClientCredentials != null)
  6: {
  7:     client.ClientCredentials.Windows.AllowedImpersonationLevel = TokenImpersonationLevel.Impersonation;
  8: }
  9: 
 10: try
 11: {
 12:     // Create First Folder
 13:     string createResult = client.CreateFolder(library + "/Folder One");
 14:     Trace.WriteLine("Create Folder Result: " + createResult);
 15: 
 16:     // Create subfolder
 17:     createResult = client.CreateFolder(library + "/Folder One/Folder Two");
 18:     Trace.WriteLine("Create Folder Result: " + createResult);
 19: }
 20: finally
 21: {
 22:     if (client.State == CommunicationState.Faulted)
 23:     {
 24:         client.Abort();
 25:     }
 26: 
 27:     if (client.State != CommunicationState.Closed)
 28:     {
 29:         client.Close();
 30:     }
 31: }

The first thing to watch out for is setting the client credentials on the client proxy. This tells the client to impersonate you to create the folders. You the client need to have the rights to create folders in the document library.


To create folders is very straight forward where you use the CreateFolder method. As you can see you specify the library title and forward slash with the new folder to create. I also show in the code to create subfolders.


Let’s Upload a Document


To upload a document we need to add another service reference to http://server/sites/personal/_vti_bin/copy.asmx. This is the Copy service.


Here is the code to upload a document to the document library:

  1: CopySoapClient client = new CopySoapClient();
  2:             
  3: if (client.ClientCredentials != null)
  4: {
  5:     client.ClientCredentials.Windows.AllowedImpersonationLevel = TokenImpersonationLevel.Impersonation;
  6: }
  7: 
  8: try
  9: {
 10:     client.Open();
 11:     string url = "http://server/sites/personal/My Documents Library/Folder One/Folder Two/";
 12:     string fileName = "test.txt";
 13:     string[] destinationUrl = { url + fileName };
 14:     byte[] content = new byte[] { 1, 2, 3, 4 };
 15: 
 16:     // Description Information Field
 17:     FieldInformation descInfo = new FieldInformation
 18:                                     {
 19:                                         DisplayName = "Description",
 20:                                         Type = FieldType.Text,
 21:                                         Value = "Test file for upload"
 22:                                     };
 23: 
 24:     FieldInformation[] fileInfoArray = { descInfo };
 25: 
 26:     CopyResult[] arrayOfResults;
 27: 
 28:     uint result = client.CopyIntoItems(fileName, destinationUrl, fileInfoArray, content, out arrayOfResults);
 29:     Trace.WriteLine("Upload Result: " + result);
 30: 
 31:     // Check for Errors
 32:     foreach (CopyResult copyResult in arrayOfResults)
 33:     {
 34:         string msg = "====================================" +
 35:                      "SharePoint Error:" +
 36:                      "\nUrl: " + copyResult.DestinationUrl +
 37:                      "\nError Code: " + copyResult.ErrorCode +
 38:                      "\nMessage: " + copyResult.ErrorMessage +
 39:                      "====================================";
 40: 
 41:         Trace.WriteLine(msg);
 42:         _logFactory.ErrorMsg(msg);
 43:     }
 44: }
 45: finally
 46: {
 47:     if (client.State == CommunicationState.Faulted)
 48:     {
 49:         client.Abort();
 50:     }
 51: 
 52:     if (client.State != CommunicationState.Closed)
 53:     {
 54:         client.Close();
 55:     }
 56: }

Again I set the client credentials to be able to upload documents to the document library. I have to specify the full URL and folder structure on where I want to upload the document too. I also have to append the filename onto the URL to upload the document.


I create a byte[] to simulate document content that will be saved in the document library. The web method that we use to upload a document only accepts an byte[] for content. If you use streams for reading a local file to upload, then you have to convert it to a byte[].


We use the CopyIntoItem method to upload the file. Firstly have to define the filename, the destination URL, file information array and a array for results that is returned.


In the example code I use the fileInfoArray to add document meta data. In the example I just add Description meta data.


When you upload the file the method returns an array of results that you can check if any errors occurred on the server for the document upload.


Hope this helps you and any feedback is welcome!


Cheerio!

This blog entry will show you how to setup SharePoint 2010 on Windows 7. Unfortunately it is not just as simple as to download SharePoint 2010 and say install. You can use SharePoint 2010 Foundation, Full SharePoint 2010 editions and Search Server 2010 Express for the rest of this blog entry.

Step 1:

Download your desired SharePoint 2010 edition. For the rest of this blog I will use SharePoint 2010 Foundation.

Step 2:

If you try to run the SharePointFoundation.exe and select Install SharePoint Foundation you will get the following error:

Setup_Error

You need to enable Windows 7 support. Before doing that we have to extract the SharePoint 2010 setup file to a directory. Go to command prompt and type the following:

Extract_Command

Step 3:

To enable Win 7 support you have to go to C:\SharePointFiles\Files\Setup folder and open config.xml in a text editor. In the file you have to add this line <Setting Id="AllowWindowsClientInstall" Value="True" />. Your file should look like this:

Enable _Win7_Config

Step 4:

Before we run the setup you need to enable IIS on Windows 7. Go to Control Panel->Program and Features->Turn Windows features on or off.

Enable_IIS

The most important features that should be enabled is the Internet Information Services and Microsoft .NET Framework 3.5.1.

A quick solution is to run the following in command prompt: ( Take out the line-breaks for command prompt )

start /w pkgmgr /iu:IIS-WebServerRole;IIS-WebServer;IIS-CommonHttpFeatures;
IIS-StaticContent;IIS-DefaultDocument;IIS-DirectoryBrowsing;IIS-HttpErrors;
IIS-ApplicationDevelopment;IIS-ASPNET;IIS-NetFxExtensibility;
IIS-ISAPIExtensions;IIS-ISAPIFilter;IIS-HealthAndDiagnostics;
IIS-HttpLogging;IIS-LoggingLibraries;IIS-RequestMonitor;IIS-HttpTracing;IIS-CustomLogging;IIS-ManagementScriptingTools;
IIS-Security;IIS-BasicAuthentication;IIS-WindowsAuthentication;IIS-DigestAuthentication;
IIS-RequestFiltering;IIS-Performance;IIS-HttpCompressionStatic;IIS-HttpCompressionDynamic;
IIS-WebServerManagementTools;IIS-ManagementConsole;IIS-IIS6ManagementCompatibility;
IIS-Metabase;IIS-WMICompatibility;WAS-WindowsActivationService;WAS-ProcessModel;
WAS-NetFxEnvironment;WAS-ConfigurationAPI;WCF-HTTP-Activation;
WCF-NonHTTP-Activation

Step 5:


After IIS is installed we need to install some additional prerequisite packages that is required by SharePoint 2010. Under c:\SharePointFiles run PrerequisiteInstaller.exe.


Required Prerequisite Packages:



Step 6:


After the prerequisite packages are installed, it is recommended to run Windows Update to install the latest patches from Microsoft.


Step 7:


Ok, now you are ready to install SharePoint 2010. Under c:\SharePointFiles run setup.exe and select the option that suite you the best. Most of the time it should be the Standalone option that will install a stand-alone SharePoint 2010 installation with SQL Server Express.


SharePoint_Install_Options


Note: After installing SharePoint 2010 check for the latest patched from Windows Updates.


Step 8:


After successful installation, you are ready to use SharePoint 2010 on Windows 7. Here is the default site that is created with sample data:


Default_Site


The default is accessible via the URL http://machine-name/.  SharePoint takes over the default port 80 on IIS.


Another page that is available is the  SharePoint 2010 Central Administration. Accessible via URL http://machine-name:34078/ Just check in IIS on which port it runs. Otherwise you can all so go to the Start menu->All Programs –> Microsoft SharePoint 2010 Products –> SharePoint 2010 Central Administration.


Central_Admin


For Development you have to follow these additional steps.


Step 9:


Install the SharePoint 2010 SDK. I’m going on the assumption that Visual Studio 2010 is already installed on Windows 7 machine. The SDK provide conceptual overviews, programming tasks, code samples for SharePoint 2010.


Step 10:


Install SharePoint 2010 Guidance. This guidance provides a deep technical insight into the key concepts and issues for SharePoint 2010 solution developers.


Helpful Additional Tools for Development:



With these steps completed you are ready to start developing with SharePoint 2010.


Enjoy SharePoint 2010.


Cheerio!

Disqus