Jean Paul's Blog

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

    Advertisements
  • 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
  • Advertisements

Posts Tagged ‘solution’

Activate Solution is Disabled (greyed out)

Posted by Paul on March 17, 2014

image

Solutions

Following are the solutions that we can try one-by-one:

  1. Restart Internet Explorer in Administrator Mode
  2. Ensure SharePoint User Code Host is running in Windows Services
  3. Ensure Microsoft SharePoint Foundation Sandboxed Code Service is started in Central Administration > Manage Services

Once applying the solution(s) the Activate button turned to be Enabled now. Great!!

image

Advertisements

Posted in SharePoint, SharePoint 2010 | Tagged: , , , , , , | 2 Comments »

How to Deploy JavaScript to Master Page through Solution?

Posted by Paul on October 2, 2013

In this article I would like to take you through a real-world problem. You are working on a Java Script method which should be deployed to multiple SharePoint servers. The Java Script needs to be included in the Master Page file.

How to deploy it?

The manual deployment requires going to each SharePoint site, Opening the page in SharePoint Designer & Editing the master page. This way is time consuming & has maintenance overheads.

How to Automate Deployment?

We need to automate the deployment process. We can use the AdditionalPageHead delegate to render our custom code to master page & everything through automated deployment.

clip_image002

Steps

Please follow the steps below to achieve the following:

· Deploy Java Script page to SharePoint Master Page

Step 1: Create new project

Open Visual Studio & Create an empty SharePoint project & name it as MasterPageCode. Choose the farm solution option.

clip_image004

Step 2: Add User Control

Add a User Control item to the project & name it as MyControl. We are going to place our JavaScript code here.

clip_image006

In the appearing user control, place the following code which says Hello World through JavaScript.

alert(‘Hello World’);

The user control looks like below:

clip_image008

Now we need to include this user control code in the Master Page. We can achieve this in the next step.

Step 3: Add Deployment Element

Choose Add new item & select the Empty Element option & name it as MyAction.

clip_image010

Replace the content of file with following code. (please ensure the folder & file names are correct)

<?xml version=”1.0″ encoding=”utf-8″?>

<Elements xmlns=”http://schemas.microsoft.com/sharepoint/”&gt;

<Control Id=”AdditionalPageHead” Sequence=”150″

ControlSrc=”~/_CONTROLTEMPLATES/MasterPageCode/MyControl.ascx”>

</Control>

</Elements>

Now the Solution Explorer looks like below:

clip_image012

Step 4: Deploy Solution

Now right click on the solution & choose the Deploy option. Wait for a few seconds & your solution will get deployed & activated automatically.

clip_image014

During runtime, the Java Script code will be appended to Master Page.

Step 4: Testing Solution

Open the default SharePoint site & you should receive the following JavaScript message box.

clip_image016

clip_image018

I thought of adding some important points:

1. The default master page of SharePoint pages is default.master & it resides in the 14 Hive > Templates > Layouts folder.

2. The AdditionalPageHead tag ensures the user control code is added to the master page. We can have multiple user controls rendered in this way.

3. The MyAction.xml file ensure the user control is deployed through the WSP file.

References

http://msdn.microsoft.com/en-us/library/ms470880(v=office.14).aspx

Summary

In this article we have explored a real world scenario. I hope the code will be useful in real word scenarios of integrating Java Script or Custom Controls to every page through solutions.

I have attached the source code along with.

Posted in SharePoint 2010 | Tagged: , , , , , , , | Leave a Comment »

Error Scenario – Workflow History list not found!

Posted by Paul on October 2, 2012

In this article we can explore a common scenario associated with creating Workflows in Visual Studio 2010.

Scenario

You are creating a workflow through Visual Studio 2010. The SharePoint 2010 templates are installed and while selecting Workflow template and entering site url you receive the following error:

The SharePoint site at URL is missing a target, task, or history list. Each of these lists is required to associate a workflow template. Please create a list and then launch this wizard.

clip_image001[5]

Root Cause

Workflow requires the following lists for its working:

· Workflow History of Template 140

· Workflow Tasks of Template 107

Solution

There are many solutions to the above problem like:

1. Create a new site from a site template that includes Workflow History & Task list

2. Create the 2 lists Programmatically

3. Create the 2 lists using PowerShell

Here I would apply the second solution, using C# code to create the 2 lists.

 

Implementation

Create a new SharePoint Console Application and change the project properties as:

· Target Framework to 3.5

Add the following code to the Main() method. Please change your url accordingly.

class Program

{

private static string URL = “http://yourblanksite&#8221;;

static void Main(string[] args)

{

using (SPSite site = new SPSite(URL))

{

using (SPWeb web = site.OpenWeb())

{

web.Lists.Add(“Workflow History”, string.Empty, SPListTemplateType.WorkflowHistory);

web.Lists.Add(“Workflow Task”, string.Empty, SPListTemplateType.Tasks);

}

}

}

}

Execute the above code and if it completed without errors, your problem is solved. Try creating the workflow again and you should not see the error.

Verification

Inside SharePoint you can verify our new lists as shown below.

clip_image003[6]

Template Enumeration Reference

You can refer the Template Enumeration (SPListTemplateType) here.

Name Description
InvalidType Not used. Value = -1.
NoListTemplate unspecified list type. Value = 0
GenericList Custom list. Value = 100.
DocumentLibrary Document library. Value = 101.
Survey Survey. Value = 102.
Links Links. Value = 103.
Announcements Announcements. Value = 104.
Contacts Contacts. Value = 105.
Events Calendar. Value = 106.
Tasks Tasks. Value = 107.
DiscussionBoard Discussion board. Value = 108.
PictureLibrary Picture library. Value = 109.
DataSources Data sources for a site. Value = 110.
WebTemplateCatalog Site template gallery. Value = 111.
UserInformation User Information. Value = 112.
WebPartCatalog Web Part gallery. Value = 113.
ListTemplateCatalog List Template gallery. Value = 114.
XMLForm XML Form library. Value = 115.
MasterPageCatalog Master Page gallery. Value = 116.
NoCodeWorkflows No Code Workflows. Value = 117.
WorkflowProcess Custom Workflow Process. Value = 118.
WebPageLibrary Wiki Page Library. Value = 119.
CustomGrid Custom grid for a list. Value = 120.
SolutionCatalog Solutions. Value = 121
NoCodePublic No Code Public Workflow. Value = 122
ThemeCatalog Themes. Value = 123
DataConnectionLibrary Data connection library for sharing information about external data connections. Value = 130.
WorkflowHistory Workflow History. Value = 140.
GanttTasks Project Tasks. Value = 150.
Meetings Meeting Series (Meeting). Value = 200.
Agenda Agenda (Meeting). Value = 201.
MeetingUser Attendees (Meeting). Value = 202.
Decision Decisions (Meeting). Value = 204.
MeetingObjective Objectives (Meeting). Value = 207.
TextBox Text Box (Meeting). Value = 210.
ThingsToBring Things To Bring (Meeting). Value = 211.
HomePageLibrary Workspace Pages (Meeting). Value = 212.
Posts Posts (Blog). Value = 301.
Comments Comments (Blog). Value = 302.
Categories Categories (Blog). Value = 303.
Facility Facility. Value = 402
Whereabouts Whereabouts. Value = 403
CallTrack Call Track. Value = 404
Circulation Circulation. Value = 405
Timecard Timecard. Value = 420
Holidays Holidays. Value = 421
IMEDic IME (Input Method Editor) Dictionary. Value = 499
ExternalList External. Value = 600
IssueTracking Issue tracking. Value = 1100.
AdminTasks Administrator Tasks. Value = 1200.
HealthRules Health Rules. Value = 1220
HealthReports Health Reports. Value = 1221

The link is added in the References section too.

References

http://tinyurl.com/sp2010-lsttmpref

Summary

In this article we have explored a common error scenario associated with workflow creation and a solution for it.

Posted in SharePoint | Tagged: , , , , , | 4 Comments »