Tag Archives: Tricks

Error occurred in deployment step ‘Install app for SharePoint’: The provided App differs from another App with the same version and product ID

SharePoint-2013

Problem:
Cannot deploy a solution and getting the error: Error occurred in deployment step ‘Install app for SharePoint’: The provided App differs from another App with the same version and product ID.

Solution:
Open the AppManifest.xml in code view and generate a new guid for the app -> Change value of ProductID.

This task requires the application to have elevated permissions.

I start my Visual Studio 2010, create new SharePoint project and after giving project name and clicking OK I get this error:

ElevatedPrivVS2010

This task requires the application to have elevated permissions.

I already started VS2010 as administrator, but that’s not the solution yet.

I log to the server via Remote Desktop with my domain account. To be able to connect VS to SharePoint, my account needs to be added to local administrators group (get your admin/domain admin to do that).
Afterwards, I need to log out from Windows (thus ending my session) and log in again. Now, when I run Visual Studio as administrator, I can create new SharePoint project.

Regular Expressions Example (c#) – CSharp

csharp

The following example shows the use of Regular Expresssions in C#.This program has basic validation scripts for validation easily useable in all programs.

/*
<HowToCompile>
csc /r:System.Text.RegularExpressions.dll,System.dll Validation.cs
</HowToComplie>
*/
using System.Text.RegularExpressions;
using System;
class Validation
{
public static void Main()
{
String strToTest;
Validation objValidate=
new Validation();
Console.Write(“Enter a String to Test for Alphabets:”);
strToTest=Console.ReadLine();
if(objValidate.IsAlpha(strToTest))
{
Console.WriteLine(“{0} is Valid Alpha String”,strToTest);
}
else
{
Console.WriteLine(“{0} is not a Valid Alpha String”,strToTest);
}
}
// Function to test for Positive Integers.
public bool IsNaturalNumber(String strNumber)
{
Regex objNotNaturalPattern=
new Regex(“[^0-9]”);
Regex objNaturalPattern=
new Regex(“0*[1-9][0-9]*”);
return !objNotNaturalPattern.IsMatch(strNumber) &&objNaturalPattern.IsMatch strNumber);
}
// Function to test for Positive Integers with zero inclusive
public bool IsWholeNumber(String strNumber)
{
Regex objNotWholePattern=
new Regex(“[^0-9]”);
return !objNotWholePattern.IsMatch(strNumber);
}
// Function to Test for Integers both Positive & Negative
public bool IsInteger(String strNumber)
{
Regex objNotIntPattern=
new Regex(“[^0-9-]”);
Regex objIntPattern=
new Regex(“^-[0-9]+$|^[0-9]+$”);
return !objNotIntPattern.IsMatch(strNumber) &&
objIntPattern.IsMatch(strNumber);
}
// Function to Test for Positive Number both Integer & Real
public bool IsPositiveNumber(String strNumber)
{
Regex objNotPositivePattern=
new Regex(“[^0-9.]”);
Regex objPositivePattern=
new Regex(“^[.][0-9]+$|[0-9]*[.]*[0-9]+$”);
Regex objTwoDotPattern=
new Regex(“[0-9]*[.][0-9]*[.][0-9]*”);
return !objNotPositivePattern.IsMatch(strNumber) &&
objPositivePattern.IsMatch(strNumber) &&!objTwoDotPattern.IsMatch(strNumber);
}
// Function to test whether the string is valid number or not
public bool IsNumber(String strNumber)
{
Regex objNotNumberPattern=
new Regex(“[^0-9.-]”);
Regex objTwoDotPattern=
new Regex(“[0-9]*[.][0-9]*[.][0-9]*”);
Regex objTwoMinusPattern=
new Regex(“[0-9]*[-][0-9]*[-][0-9]*”);
String strValidRealPattern=”^([-]|[.]|[-.]|[0-9])[0-9]*[.]*[0-9]+$”;
String strValidIntegerPattern=”^([-]|[0-9])[0-9]*$”;
Regex objNumberPattern =
new Regex(“(” + strValidRealPattern +”)|(” +
trValidIntegerPattern + “)”);
return !objNotNumberPattern.IsMatch(strNumber) &&!objTwoDotPattern.IsMatch
strNumber) && !objTwoMinusPattern.IsMatch(strNumber) && objNumberPattern.IsMatch(strNumber);
}
// Function To test for Alphabets.
public bool IsAlpha(String strToCheck)
{
Regex objAlphaPattern=
new Regex(“[^a-zA-Z]”);
return !objAlphaPattern.IsMatch(strToCheck);
}
// Function to Check for AlphaNumeric.
public bool IsAlphaNumeric(String strToCheck)
{
Regex objAlphaNumericPattern=
new Regex(“[^a-zA-Z0-9]”);
return !objAlphaNumericPattern.IsMatch(strToCheck);
}
}

There is another simple way to perform these validation think of it while the next article comes.

SharePoint 2013 – There are 2 layouts and images folders

SharePoint-2013

When you have the beta version of SharePoint 2013 running, you will notice that even if you never installed SharePoint 2010 on your brand new image.

Both the 14 and 15 root folder are available.

sp2013rootfolder

This means that we have 2 layouts folders and 2 images folders!

I created 2 small images called test.gif

C:\Program Files\Common Files\microsoft shared\Web Server Extensions\14\TEMPLATE\IMAGES\test\test.gif “14 folder”
C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\TEMPLATE\IMAGES\test\test.gif “15 folder”
When I navigated to http://sp/_layouts/images/test/test.gif the following image is shown

14folder1

But how do we use the content of the 15 directory? Easy!

When we navigate to http://sp/_layouts/15/images/test/test.gif the image in the 15 directory is displayed.

15folder

Summary

{weburl}/_layouts/ —— C:\Program Files\Common Files\microsoft shared\Web Server Extensions\14\TEMPLATE\LAYOUTS
{weburl}/_layouts/images —— C:\Program Files\Common Files\microsoft shared\Web Server Extensions\14\TEMPLATE\IMAGES
{weburl}/_layouts/15/ —— C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\TEMPLATE\LAYOUTS
{weburl}/_layouts/15/images —— C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\TEMPLATE\IMAGES

Deactivate the New Item Pop Up Window in SharePoint 2010

Does this pop up menu irritate you in your lists when you click Add New Item? Especially because you can’t send the link for people to fill in a form. You would need to edit the link and replace allitems.asp with newform.aspx first.

new-form-1

It’s super easy to deactivate that. Click on List on the ribbon, List Settings and Advanced Settings. Right at the bottom is Dialogs – simply change that setting to No.

new-form-2

Then when you click Add New Item again in your list – voila! Now it’s easy to send out the link and ask people to fill in your form.

new-form-3

View all resources and events from a SharePoint Calendar (Resolved)

SharePoint-2013

The other day a client was having a problem with a OOTB Calendar in SharePoint 2010. They had created a new site and set up Resources for the Calendar. After they had done this, anytime they went to add an event to the calendar it would not show on the calendar view. Even if they created a new calendar, the same would happen. If they switched the view to the All Events view, they would see the events they had created yet the actual calendar view was empty. After looking into this we realized when Resources are active it changes the content type for the calendar list (from Events to Resources). For whatever reason, when this happens, SharePoint’s calendar view no longer recognizes these new events. If the content type was changed back to Events, they would show in the calendar but then they could not set Resources.

Now we had to figure out how to have both, as this was critical to the client. Luckily it is not too difficult of a fix to get both working. Here is what you would need to do (assuming you already set up Resources).

  • Create a calendar and in More Options select ‘Use this calendar for resource reservations’
  • Once created, go to the list settings for the calendar
  • Click ‘Title, Description, and Navigation’ and set ‘Use calendar for resource reservation’ to no
  • Back in the calendar list settings, click ‘Change new button order and default content type’
  • Check ‘Reservations’ and set it to the default content type
  • That is it! now you should be able to add new events like always, while being able to assign resources and check their availability.

SharePoint 2013: Minimal Download Strategy

SharePoint-2013

Problem :

Its been quite a while since SharePoint is in market.It has come a long way since it evolution in 2003. It takes a lot of hard work to convince customers to make a move from their traditional Content Publisher to SharePoint platform and SharePoint has been emerged as one of the market leader in that.

More often SharePoint is been criticized for its performance; it is been always said that SharePoint loads the page slowly and it takes a considerably amount of time to load the heavy sites including the involvement of external database. To overcome this many concepts like caching is been evolved; which still refresh the whole page rather than loading the only part of a page which is been modified; but recent version of SharePoint has introduced a concept of “Minimal Download Strategy”.

It is nothing but a feature which is activated by default on SharePoint Team Sites. Its technique to use single page “_layouts/15/start.aspx” with URL encoded with following # text.

Solution :

Minimal download strategy improved the SharePoint Site performance by improving navigation,fast rendering on client browser. It also reduces the SharePoint page load time, because it loads only a part of a page which is been modified rather than getting a duplicate data from server.

To remove this extra text from URL you need to deactivate this feature at site collection level.To deactivate this feature go to site Settings -> Manage Site Features – > Find Minimal Download Strategy Feature – > Click on Deactivate.

Upon deactivation of this feature you will see text “_layouts/15/start.aspx” is been removed from SharePoint Site URL.

Note: However this is been recommended that MDS should be enables on SharePoint Site for performance improvement.