Jean Paul's Blog

There are 2 types of People in the World, One who Likes SharePoint and..

  • Microsoft MVP

  • MindCracker MVP

  • CodeProject MVP

  • eBook on SharePoint 2010

  • eBook on Design Patterns

  • eBook on Windows Azure

  • NLayers Framework @ CodePlex

  • MSDN Forums

  • .Net vs. Java

    Due to Public Demand

Archive for April, 2012

Error: This document was checked out to your local drafts folder but the local copy could not be checked in or check out could not be discarded. Close any application that is editing the document and try to check in again, or discard the checkout.

Posted by JP on April 27, 2012

My customer was reporting the following error.  He was in the middle of Check out of a document.

Now the user interface is not allowing Check In / Discard Check Out

image

Solution

Go to the SharePoint Drafts folder and Delete the particular file from there.

eg: C:\Users\HP\Documents\SharePoint Drafts

(Please ensure  you have a backup copy)

image

In my customer case the solution worked well and he was happy.

 

Local Drafts Folder

The local drafts folder helps in working offline.  The checked out document gets saved here temporarily.

You will be getting the prompt while Check Out of a document.

image

The drafts folder is located in the Operating System Drive > User > Documents > SharePoint Drafts

eg: C:\Users\HP\Documents\SharePoint Drafts

Advertisements

Posted in C# | Leave a Comment »

Web Database Templates

Posted by JP on April 26, 2012

There are many site templates included in SharePoint 2010.  In this article we can explore web database templates included in SharePoint 2010.  The 5 web database templates are:

1.      Assets Web Database

2.      Charitable Contributions Web Database

3.      Contacts Web Database

4.      Issues Web Database

5.      Projects Web Database

What is a Web Database Template?

Web Database Template provides Site Templates for Browser based interaction to an MS Access application.   Thus web database templates provide Centralized Access for the database file, Flexibility in working with Access application without having MS Access installed in the client computer etc.

SharePoint 2010 is having some pre build Web Database Templates for ready use.  These templates provide solutions to the respective area as their name denotes. 

Under the hood SharePoint has Access Service Application running to support the web database templates.  You can configure the service applications & services through Central Administration.

Advantages of Web Database

Following are the advantages of using Web Database:

·         Supports uploading of Access Application into SharePoint

·         Access Application can be accessed through a Browser

·         Centralized database storage for Access Application

·         Flexibility in downloading the application file and working offline

Note: There are thousands of users having created their own MS Access solution involving Tables, Forms and Reports.  The Access Service application allows them to Publish these solutions to the SharePoint site.


Pre-Requisites for Web Database

As the web databases are using Access Service Application and Access Services, following are the pre-requisites:

1.      Access Service Application has to be created and started in Central Administration

clip_image002

 

2.      Access Database Service has to be started in Central Administration

clip_image004

Is MS Access needed in Client Machine?

MS Access is not needed to work with Web Database site templates.  But having MS Access enables more flexibility in working as it allows opening server database file in the client side.

Using MS Access with Web Database

You can use the Open in Access action to edit the web database file.

clip_image005

Assets Web Database

The Assets Web Database provides a site template for managing Assets in an organization.  It provides Assets management through creating Current Assets, Retired Assets and Reports.  The Owner of the Asset can be managed through the Users interface. 

We can create new Assets Web Database template using Site Actions > New Site > Assets Web Database Template.

clip_image007

Following is the initial site instance screen:

clip_image009 

Charitable Contributions Web Database

The Charitable Contributions Web Database provides a site template for managing Charity Contributions activities.  The site provides pages to manage Donors, Campaigns, Users, Upcoming events and Reports.

We can create new Charitable Contributions Web Database template using Site Actions > New Site > Charitable Contributions Web Database Template.

clip_image011

Following is the initial site instance screen:

clip_image013

Contacts Web Database

The Contacts Web Database provides a site template for managing Contacts information.  The template provides Contact Entry Forms to capture Name, Email, Address, Phone details and Reports.

We can create new Contacts Web Database template using Site Actions > New Site > Contacts Web Database Template.

clip_image015

Following is the initial site instance screen:

clip_image017

Issues Web Database

The Issues Web Database provides a site template for managing Issues and Problems.    The template provides Issue Creation forms, Prioritizations and other screens to track the progress of fixing issues.

We can create new Issues Web Database template using Site Actions > New Site > Issues Web Database Template.

clip_image019

Following is the initial site instance screen:

clip_image021

Projects Web Database

The Projects Web Database provides a site template for managing Projects.  The template provides screens to manage Projects, Tasks, Customer, Assign Tasks and generate reports.

We can create new Projects Web Database template using Site Actions > New Site > Projects Web Database Template.

clip_image023

Following is the initial site instance screen:

clip_image025


 

Site Settings & Site Permissions

As the web database template instances are still Sites, we can use the Site Settings and Site Permissions options on them.

To access the Site Settings, choose the Options menu item from the title area.

clip_image026 

To access the Site Permissions, choose the Options menu item from the title area.

clip_image027

References

http://tinyurl.com/sp2010-accser

Summary

In this article we had an overview of the 5 web database templates in SharePoint 2010.  You can use the associated video to get more detailed information on them.  Although not widely used, the knowledge of these templates should be helpful in creating rapid solutions or reusing existing solutions around MS Access.

Posted in C# | Leave a Comment »

TFS :: Programmatically get folder content

Posted by JP on April 20, 2012

In this small article, I would like to show you how to get the contents of the folder from TFS server.

The post could be useful while creating deployment tools.

1. Create a new Console Application

2. Add references to following assemblies

Microsoft.TeamFoundation.Client;
Microsoft.TeamFoundation.VersionControl.Client;
You can get those from the references assembly or from folder 
C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\ReferenceAssemblies\v2.0
3. Get the TFS server url 
Use Team Explorer to connect to a TFS server and use Properties window to the get the url.
image
4. Get the path to required folder
Get the folder path from Source Control Explorer
Eg: $/Projects/MyApplication
5. Use the following code to retrieve all folders
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.TeamFoundation.Client;
using Microsoft.TeamFoundation.VersionControl.Client;
 
namespace MyConsoleApp
{     class Program     {         static void Main(string[] args)         {             RegisteredProjectCollection server = RegisteredTfsConnections.GetProjectCollection(new Uri("URLHER"));             TfsTeamProjectCollection projects = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(server);             VersionControlServer versionControl = (VersionControlServer)projects.GetService(typeof(VersionControlServer));             Workspace workspace = versionControl.CreateWorkspace(AppDomain.CurrentDomain.FriendlyName + "-installer", versionControl.AuthorizedUser);             WorkingFolder folder = new WorkingFolder("$PATH", "c:\\output");             workspace.CreateMapping(folder);             workspace.Get(); // Receive all the files             workspace.Delete();         }     }
}
6. Execute the application
Now you can see the c:\output folder to view the files.
image
var dzone_url = ‘https://jeanpaulva.wordpress.com/2012/04/20/tfs-programmatically-get-folder-content/’;var dzone_title = ‘TFS :: Programmatically get folder content’;var dzone_blurb = ‘TFS :: Programmatically get folder content’;var dzone_style = ‘2’;

Posted in C#, SharePoint | Tagged: , , | Leave a Comment »

WCF Large Data Upload Problem and Resolution

Posted by JP on April 11, 2012

While dealing with large data using WCF services you might have encountered the following error message.

image

Type: ProtocolException

Message: The remote server returned an unexpected response: (400) Bad Request.

Problem: The message size was exceeded and it resulted in reconstructing the message at server side.  So the incomplete message lead to Protocol Exception.

Solution

The solution is to increase the Received Message Size for the service.  Please do the following.

1. Add the following tags inside the service configuration.

  maxReceivedMessageSize=”2147483647″  maxBufferSize=”2147483647″

2. Build the service

3. Update the client consumer with the new service reference

Example

// Interface

namespace WCF_LargeUpload
{
    [ServiceContract]
    public interface IService1
    {
        [OperationContract]
        int Save(DataSet ds);

        [OperationContract]
        DataSet Get();
    }
}

// Service

namespace WCF_LargeUpload
{
    public class Service1 : IService1
    {
        public int Save(System.Data.DataSet ds)
        {
            return ds.Tables[0].Rows.Count;
        }

        public System.Data.DataSet Get()
        {
            DataSet ds = new DataSet();
            ds.Tables.Add(new DataTable() { });
            ds.Tables[0].Columns.Add(new DataColumn() { ColumnName = “Id”, DataType = typeof(int) });
            ds.Tables[0].Columns.Add(new DataColumn() { ColumnName = “Name”, DataType = typeof(string) });

            for (int i = 1; i <= 1000; i++)
                ds.Tables[0].Rows.Add(1, “A lengthy Name for the Item”);

            return ds;
        }
    }
}

// Server Config

<?xml version=”1.0″?>
<configuration>

  <system.web>
    <compilation debug=”true” targetFramework=”4.0″ />
  </system.web>
  <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name=”NewServiceBinding”   maxReceivedMessageSize=”2147483647″  maxBufferSize=”2147483647″>
          <readerQuotas maxDepth=”2147483647″ maxStringContentLength=”2147483647″ maxArrayLength=”2147483647″ maxBytesPerRead=”2147483647″ maxNameTableCharCount=”2147483647″/>
          <security mode=”None”>
          </security>
        </binding>
      </basicHttpBinding>
    </bindings>
    <services>
      <service behaviorConfiguration=”NewServiceBehavior” name=”WCF_LargeUpload.Service1″>
        <endpoint  address=”” binding=”basicHttpBinding” bindingConfiguration=”NewServiceBinding”
          contract =”WCF_LargeUpload.IService1″>
        </endpoint>
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>

        <behavior name=”NewServiceBehavior”>
          <serviceMetadata httpGetEnabled=”true” />
          <dataContractSerializer maxItemsInObjectGraph=”2147483647″ />
          <serviceDebug includeExceptionDetailInFaults=”true” />
          <serviceThrottling
               maxConcurrentCalls=”500″
               maxConcurrentSessions=”500″
               maxConcurrentInstances=”500″
                    />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment multipleSiteBindingsEnabled=”true” />
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests=”true”/>
  </system.webServer>

</configuration>

// Client Console Application

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            Service1Client client = new Service1Client();

            DataSet ds = new DataSet();
            ds.Tables.Add(new DataTable() { });
            ds.Tables[0].Columns.Add(new DataColumn() { ColumnName = “Id”, DataType = typeof(int) });
            ds.Tables[0].Columns.Add(new DataColumn() { ColumnName = “Name”, DataType = typeof(string) });

            for (int i = 1; i <= 1000; i++)
                ds.Tables[0].Rows.Add(1, “abcdefghijklmnopqurstuvwxyzabcdefghijklmnopqurstuvwxyzabcdefghijklmnopqurstuvwxyzabcdefghijklmnopqurstuvwxyz”);

            int result = client.Save(ds);

            Console.WriteLine(result);
           
            Console.ReadKey(false);
        }
    }
}

This post confirms my ownership of the site and that this site adheres to Google AdSense program policies and Terms and Conditions: ca-pub-9482913752970808

Posted in C# | Tagged: , , | Leave a Comment »

SharePoint 2010 – Enterprise Document Management

Posted by JP on April 11, 2012

SharePoint provides good amount of features supporting Enterprise Document Management.

clip_image002

The main features supported by SharePoint 2010 are:

1. Metadata

2. Versioning

3. Alerts

4. Workflows

5. Check Out

6. Search

7. Co Authoring

8. Auditing

Versioning

SharePoint supports public, major and minor versioning support. To enable versioning use the Library Settings > Versioning settings option.

clip_image004

Metadata

We can store information about the library items as Metadata using Columns. For adding Metadata for any library item use the Library Settings > Create Column option.

clip_image006

Using Enterprise Keywords we can tag a particular document. As they are indexed they are searchable and provide meaningful organizational capabilities.

Types of Libraries

SharePoint 2010 provides different types of in-built document libraries.

Library Type

Description

Document Library

For all document types

Asset Library

For images, video files

Connection Library

Storing connection files

Report Library

KPI (Key Performance Indicator), BI files

Slide Library

PowerPoint Slide files

Picture Library

Picture files

Form Library

InfoPath Form files

Document ID Service

The document ID feature creates document identifiers that can be used to retrieve items independent of their current location. The document ID service is responsible for providing the Document ID feature.

When a document is added to the collection SharePoint assigns the Document ID to it. The administrator needs to configure the Persistence setting of Document ID.

To enable this feature use Site Actions > Site Settings > Site Collection Features item.

clip_image008

Click on the Activate button to make the service running.

Document Set

Document Set is a new feature in SharePoint 2010. It is similar to a zip file and a good solution while working with a group of files. While working with a project, people usually needed a set of files instead of a single file. So the Document Set feature is really useful once we know how to use it.

To enable this feature use Site Actions > Site Settings > Site Collection Features item.

clip_image010

Click on the Activate button to make the service running.

The creation of document and document sets are discussed in the upcoming article.

References

http://msdn.microsoft.com/en-us/library/ee559302.aspx

http://office.microsoft.com/en-us/sharepoint-server-help/introduction-to-document-sets-HA101782466.aspx

Summary

In this article we have explored the Document Management Features supported by SharePoint. The versioning, check out, co authoring features provides the SharePoint end users a great tool in hand.

Posted in C#, SharePoint | Tagged: , , | Leave a Comment »

SharePoint 2010 – Views, Lookups and Validations in List

Posted by JP on April 11, 2012

Views

We can associate a View for a List. Views provide a different representation of the existing information. If a List has columns Name and Country we can create a View for the List with county as India. Here we are experimenting with custom column creation as well.

For this create a new List with Custom List as the template.

clip_image002

Add the following columns into it.

· Name

· Country

Now add the following data into the Contacts List

clip_image004

Now there are 2 records with India and Other as country.

From the List ribbon item and click Create View button.

clip_image006

In the appearing page select Standard View option.

clip_image008

In the appearing page, enter the name for the view as Contacts in India.

Scroll down and in the Filter section use Country as filter equal to India.

clip_image010

Click the Ok button to create the View. Now you can see the view only lists one record.

clip_image012

This concludes our View creation.

Note: Views can be used to show grouped data, filtered data etc. based on the existing Lists items. In this way it is similar to the database Views which operate on tables. In SharePoint the contents are getting stored in SQL Server database.

Lookups

A column in a List can integrate with another List column. For example we have 2 lists.

Doctor List

Title

Name

Qualification

Patient List

Title

Name

Address

Doctor (Referring to Doctor.Name column)

Here the Patient List is referring to Doctor List through the Doctor column which is acting as a Lookup column.

To accomplish the same create a custom list named Doctors with Name and Qualification as columns.

Note: The Title column will be already there, renaming/deleting can be done through the List Settings screen.

Now create a new list named Patients using Custom List template. Add the properties Name, Address and Doctor. For the column Doctor choose Lookup field.

clip_image014

Choose the highlighted list items as shown in the screen above. The Lookup field is required to fetch data from other Lists. We need to specify the List and Column for Lookups.

After setting the Lookup properties click the Ok button.

Now add some data to the Doctors list as shown below:

clip_image016

Now use the Add new item for the Patients List. You will be able to see the Doctor lookup field auto populated from the Doctors List.

clip_image018

Enter the details and click Save button. You are ready with the Patient with Doctor as Lookup value.

clip_image020

So this concludes our experiment with Lookup values. In real life scenarios we will end up with multiple Lookup values and validations. The Lookup values are implemented using Relationships. It is similar to the foreign key relations of a Relational Database Management System like SQL Server.

Validations

We can add validations for the columns. Now we can start experimenting with them. Here we are starting with a List of Employees. The columns are:

· Title

· Name

· Age

Make sure that the Age column is in the range 18 to 100. Any out of range values should populate the error message “Invalid Age – Please enter a value between 18 and 100!”

Create a List from the Custom List template and name it as Employees. Add custom column Name and Age. For the Age column make the type as Number. In the Column Validation section at bottom enter the following properties.

Formula: =AND(Age>=18,Age<=100)

User Message: Invalid Age – Please enter a value between 18 and 100!

clip_image022

Click the Ok button to continue. Now the List is ready with Name and Agecolumns.

Try to add a new item into the list with an invalid age (age = 11 for example)

clip_image024

You can see that the error message is shown for invalid Age.

This concludes our experiment with validations. In real world scenarios more complex validations need to be performed. For reference on the formulas you can use the link provided in the References section of this article.

References

http://office.microsoft.com/en-us/windows-sharepoint-services-help/examples-of-common-formulas-HA001160947.aspx

Summary

In this article we have learnt about Views, Lookups and Validations. These knowledge are needed in building real world record management systems using SharePoint 2010.

Posted in C#, SharePoint | Tagged: , , | Leave a Comment »

SharePoint 2010 – New Features

Posted by JP on April 11, 2012

In this article we can explore the new features of SharePoint 2010. Some of the new features of SharePoint 2010 are:

· Ribbon UI

· Status Bar

· Dialogs

· Branding and Theming

· Multilingual User Interfaces

· Inline Editing

· Developer Dashboard

· Silverlight Web Part

· Service Applications

For exploring the features please open the SharePoint 2010 default web application.

Eg: http://yourmachinename

Ribbon UI

The Ribbon User Interface can be considered as a major UI change in SharePoint 2010. It makes it similar to the Microsoft Office family of products. The advantages are user friendliness, easier access, categorized menus etc.

clip_image002

Opening a list shows the above Ribbon UI.

Status Bar

SharePoint 2010 provides a Status Bar which is below the Ribbon UI. It is not the Browser status bar. The Status Bar is configurable through pages.

Inline Editing

SharePoint 2010 allows the List items to be edited inline. This is without the use of an additional dialog with Ok/Cancel buttons. For enabling this we have to use the Modify View option in List Settings and choose Inline Editing enable checkbox.

New Dialogs

The dialogs are enhanced in SharePoint 2010. Some of the examples are given below.

New List and Library Dialog, Status Dialog

clip_image004

clip_image006

Branding and Theming

In SharePoint a new theme engine is included. This allows the users to create a theme from PowerPoint and use it inside SharePoint 2010.

The existing themes can be found in the Theme Gallary. (Site Actions > Site Settings > Themes)

clip_image008

You can anytime change the Site theme using the Site Settings > Look and Feel > Site theme option.

clip_image010

Silverlight Web Part

New silverlight web part has been added to SharePoint 2010. This allows us to embed silverlight applicatons inside the web pages. You can access this from the Add Web Part screen.

clip_image012

Developer Dashboard

The developer dashboard is a new feature in SharePoint 2010 which can be used for debugging and tracing purposes. It provides the performance related information to the developers. It is by default turned off and can be enabled by using PowerShell or StsAdm tool.

Service Applications

In the older version SharePoint 2007 there exists Shared Services Providers (SSP). This feature no longer exists in the SharePoint 2010 version and only Service Applications exists. The service applications like Search, Excel Services are unboxed and run independently.

References

http://msdn.microsoft.com/en-us/library/ee557323.aspx

http://weblogs.asp.net/soever/archive/2009/10/20/sharepoint-2010-spc09-ssp-is-dead-long-live-service-applications.aspx

Summary

In this article we have explored the new features of SharePoint 2010.

Posted in C#, SharePoint | Tagged: , , | 2 Comments »

Code :: Get Controls Recursively

Posted by JP on April 6, 2012

Returns the list of controls in a form irrespective of the container it has.

(extensibility possible to web forms as well)

private IList<Control> _controlsList = new List<Control>();

public IEnumerable<Control> GetControlsRecursively(Control container)
{
_controlsList.Clear();
FindControlsRecursively(container);

return _controlsList;
}

private void FindControlsRecursively(Control container)
{
foreach (Control control in container.Controls)
{
_controlsList.Add(control);
if (container.HasChildren)
FindControlsRecursively(control);
}
}

Posted in C# | Tagged: , , , | Leave a Comment »