Archive

Archive for May, 2011

Operations performed on a solutions package

Installing and deploying a solution package

After we have packaged the solution, we need to deploy and install it in SharePoint environment.  The installation process copy the solution package file to configuration database and register it as a solution which is ready to be installed, the deployment process pushes the code to each web server.

There are more than way for installing and deploying the Solution package

1-      Using the SharePoint developer Tools (using Visual Studio 2010).

2-      Using PowerShell scripts.

3-      Using STSADM commands.

Using the SharePoint developer Tools (using Visual Studio 2010)

We can deploy our solution by using Visula Studio 2010, by right Click on Project Name then select Deploy

 

Using PowerShell Scripts

Another option for Deploying and installing Solution Package by using Power Shell Scripts , firstly we need to load Microsoft.SharePoint.PowerShell then calling Add-SPSolution Command and passing        –LiterPath parameter using Solution path value.

For installaing the solution package use the following Scripts:-

Add-PSSnapin Microsoft.SharePoint.PowerShell  -ErrorAction  “SilentlyContinue”

Add-SPSolution –literpath “C:\Solutions\StockExchange.wsp”

For Deploying the solution package use the following Scripts:-

Install-SPSolution –identity  “StockExchange.WSP” –local –GACdeployment

There are 3 parameters , -identity whose value must be the name of the solution , -local which means that the deployment will be deployed on local server, – GA deployment used with solutions which have Dll which will added to GAC.

For complete deploying and installing Scripts:-

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction “SilentlyContinue”

Add-SPSolution -LiteralPath “C:\Solutions\ StockExchange.wsp”

Install-SPSolution -Identity ” StockExchange.wsp” -Local -GACDeployment

Using STSADM Commands

The third option for deploying and installing solution package is using STSADM commands, for deploying solution package use the following commands

stsadm -o deploysolution

   -name <solution name>

   [-url] <virtual server URL>

   [-allcontenturls]

   [-time] <time to deploy>

   [-immediate]

   [-local]

   [-allowgacdeployment]

   [-allowcaspolicies]

   [-lcid] <language>

   [-force]

 

 

For installing solution package use the following syntax

stsadm -o addsolution

   -filename <solution file name>

   [-lcid] <language>

Create Visual web part using sandbox solution in SharePoint server 2010

May 24, 2011 39 comments

As we know sand box solution runs under some restrictions, such as making changes to file system, so visual web parts deployment not allowed in a sand box solutions because it contains user control item which is deployed to the _controltemplates virtual directory in the physical file system. You cannot use a sandbox solution to deploy a visual web part using visual studio 2010 Visual Web Part project template because sandbox solution does not allow deploying files in the 14 hive.

But , now there is a power tool called Visual Studio 2010 SharePoint Power Tools which install template for creating visual web parts using sandbox solution.

You can download this tool from this link

http://visualstudiogallery.msdn.microsoft.com/8e602a8c-6714-4549-9e95-f3700344b0d9/

create visual web part using sandbox solution

1-    Open visual studio 2010.

2-    Create new empty SharePoint project.

3-    Click right click on project name , select add new item  , select visual web part (sand box ).

4-    Open ascx file and add Calendar control and text box control.

5 –    Deploy this visual web part, and browse to the place where the web part deployed then edit page .

6-    This web part will be displayed as the following

Comparison between workflow created using SharePoint Designer and Visual Studio Designer for Windows Workflow Foundation

SharePoint Designer

Visual Studio Designer for Windows Workflow Foundation.
Can write only sequential workflows. Can write both sequential and state machine workflows.
 Automatic deployment against the specific list or library against which workflow is being designed. Can be deployed as a feature.
Logic is defined declaratively using Steps which comprises of Conditions and Actions Logic could be defined through custom code written using C# or VB.NET.
Workflows could be associated to a specific list or library. Workflow can be authored as Template which once deployed could be associated with any list or library.
Workflow modifications not possible. Workflow modifications are possible using Modification forms built using ASP.NET or InfoPath form.
Workflow markup, rules all are stored as a document library on the site. Workflows are compiled as an .NET assembly.
Can’t be debugged. Debugging is possible using Visual Studio.
ASP.NET Forms only can be used as an input form

ASP.NET and InfoPath  Forms can be used as input forms

references:-
http://nishantrana.wordpress.com/2009/02/11/difference-between-workflow-created-using-sharepoint-designer-and-visual-studio-designer-for-windows-workflow-foundation/

Loading SharePoint Web Parts Contents Asynchronously Using Update Panel and Ajax

May 18, 2011 28 comments

Source Code

DownLoad

If we develop web parts that retrieve data from across the network without asynchronous processing, our web parts will have serious limitations when it comes to optimizing page response. For achieving the optimization factor in page response you need to use the asynchronous processing support provided by the ASP.NET Framework.

For implementing asynchronous in our web parts, we have more than one way

1-      Using CallBackEventHandler interface.

2-      Using ASP.NET AJAX.

Here, we will implement asynchronous using update panel and AJAX. Firstly, our example is a web part connects to YAHOO! Finance web service for retrieving data about stock exchange.

Prerequisites

1-      Visual Studio 2010.

2-      SharePoint Server 2010.

Creating Stock exchange Web Part

As we said above our web part will connect to internet web service which will have limitations in page response so for avoiding this limitation we need to load

Here, for optimizing page response we want to load the entire page firstly then load all of the important parts on the page first and then load the slower loading part(s) later. While the page is loading, placeholders are displayed to indicate that additional content is coming. After the page loads, the content for the placeholders is retrieved and displayed asynchronously.

 Here, we  create two views, one for displaying loading process with an animated image (GIF) as previous screen shot and the second display the content of the web part as the following

Steps:-

1-      Create New Project with Visual Studio 2010.

2-      Select Visual Web Part project Template.

3-      Open user control file.

4-      Add to user control, Update panel from toolbox.

5-      Now, we create the first view which represents Loading Process

6-      Create the second view which represents content view, this view contains fields for each of Stock Symbol, Date, Index Value, and image for value.

7-      Add ASP timer control for doing the post back to start connecting to remote web service for retrieving the Stock Exchange value.

8-      In The ASP:Timer’s OnTick event — triggered 1ms after the page loads — triggers the routine to load Stock Exchange

This our web part logic

Full Code Shot:-

 

Source Code

DownLoad

how to use the AJAX Control Toolkit with SharePoint 2010

May 16, 2011 1 comment

Using the AJAX Control Toolkit with SharePoint 2010

The problem is that the latest build of the Ajax Control Toolkit is optimized for .net 4.0. Where SharePoint is still 3.5.

So I downloaded the latest 3.5 AjaxControlToolkit binary and stuck it into GAC.

http://ajaxcontroltoolkit.codeplex.com/releases/view/33804 .

I added the following to Sharepoint Foundation 2010 web.config of the site:

<assemblies>

<add assembly=”AjaxControlToolkit, Version=3.5.40412.0, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e” />

</assemblies>

<controls>

<add tagPrefix=”ajaxToolkit” namespace=”AjaxControlToolkit” assembly=”AjaxControlToolkit, Version=3.5.40412.0, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e” />

</controls>

<SafeControls>

<SafeControl Assembly=”AjaxControlToolkit, Version=3.5.40412.0, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e” Namespace=”AjaxControlToolkit” TypeName=”*” Safe=”True” />

</SafeControls>

I changed the v4.master Page ScriptManager:

From: <asp:ScriptManager id=”ScriptManager” runat=”server” EnablePageMethods=”false” EnablePartialRendering=”true” EnableScriptGlobalization=”false” EnableScriptLocalization=”true” />

To: <ajaxToolkit:ToolkitScriptManager id=”ScriptManager” runat=”server” EnablePageMethods=”false” EnablePartialRendering=”true” EnableScriptGlobalization=”false” EnableScriptLocalization=”true”
/>

References:-

http://srikanthmicrosoft.blogspot.com/2011/04/using-ajax-control-toolkit-with.html

sharepoint 2010 user profile synchronization failing event id 6050

May 8, 2011 1 comment

SP2010: FIMSynchronizationService errors when running Profile Synchronization

Issue :

Profile import from AD fails. We are able to successfully create Synchronization Connection, but when trying to run Full or Incremental Profile Synchronization, you are greeted with errors in Application Event Log such as this:

Log Name: Application
Source: FIMSynchronizationService
Date: 17.2.2010 9:23:03
Event ID: 6050
Task Category: Management Agent Run Profile
Level: Error
Keywords: Classic
User: N/A
Computer: wv002578.eu.tieto.com
Description:
The management agent “MOSSAD-[SYNCHRONIZATION CONNECTION NAME]” failed on run profile “DS_DELTAIMPORT” because of connectivity issues.

Cause:

this error occurs when  the Service Account you used to run the Forefront Identity Manager Synchronization Service(FIMSynchronizationService) doesn’t has the Active Directory Secuiry Rights for “ Replicating Directory Changes”.

Resolution:

1.Open the Active Directory Users and Computers snap-in
2.On the View menu, click Advanced Features.
3.Right-click the domain object, such as “company.com”, and then click Properties.
4.On the Security tab, if the desired user account is not listed, click Add; if the desired user account is listed, proceed to step 7.
5.In the Select Users, Computers, or Groups dialog box, select the desired user account, and then click Add.
6.Click OK to return to the Properties dialog box.
7.Click the desired user account.
8.Click to select the Replicating Directory Changes check box from the list.
9.Click Apply, and then click OK.
10.Close the snap-in.
NOTE: Group “Domain Admins” already has the above right however if you are still seeing this issue add the service account explicitly to the AD Security

user profile service an update conflict has occurred and you must retry this action

Issue :

While we were trying to delete User Profile Service application in SharePoint 2010 the following error message was appear:

 An update conflict has occurred, and you must re-try this action. The object UserProfileApplication Name=User Profile Service Application was updated by [User]

Cause:

This issue occurs if the contents of the file system cache on the front-end servers are newer than the contents of the configuration database. After you perform a system recovery, you may have to manually clear the file system cache on the local server.

Resolution:

To resolve this issue, clear the file system cache on all servers in the server farm on which the Windows SharePoint Services Timer service is running.

Microsoft has provided a step by step procedure on clearing file system cache from the SharePoint front-end servers in this kb article.

  1. Stop the Windows SharePoint Services Timer service (Found in Windows Services)
  2. Navigate to the cache folder
    In Windows Server 2008, the configuration cache is in the following location:
    Drive:\ProgramData\Microsoft\SharePoint\Config
    In Windows Server 2003, the configuration cache is in the following location:
    Drive:\Documents and Settings\All Users\Application Data\Microsoft\SharePoint\Config
    Locate the folder that has the file “Cache.ini”
    (Note: The Application Data folder may be hidden. To view the hidden folder, change the folder options as required)
  3.  Back up the Cache.ini file.
  4. Delete all the XML configuration files in the GUID folder. Do this so that you can verify that the GUID folder is replaced by new XML configuration files when the cache is rebuilt.
  5. Note When you empty the configuration cache in the GUID folder, make sure that you do not delete the GUID folder and the Cache.ini file that is located in the GUID folder.
  6. Double-click the Cache.ini file.
  7. On the Edit menu, click Select All. On the Edit menu, click Delete. Type 1, and then click Save on the File menu. On the File menu, click Exit.
  8. Start the Windows SharePoint Services Timer service
  9. Note The file system cache is re-created after you perform this procedure. Make sure that you perform this procedure on all servers in the server farm.
  10. Make sure that the Cache.ini file in the GUID folder now contains its previous value. For example, make sure that the value of the Cache.ini file is not 1.