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.

Advertisements

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 Prerequisites Install Error

SharePoint-2013

While installing SharePoint 2013 prerequisites on Windows Server 2012 and SQL Server 2012, I have received the error “There was an error installing the prerequisites…” After checking out the logs (under %TEMP%\prerequisiteinstaller.<date>.<time>.log), you quickly learn that prerequisite install failed because of Microsoft SQL Server 2008 R2 SP1 Native Client.

To bypass this problem, you can manually download Microsoft SQL Server 2008 R2 SP1 Native Client from http://download.microsoft.com/download/9/1/3/9138773A-505D-43E2-AC08-9A77E1E0490B/1033/x64/sqlncli.msi and install it. After you manually download Microsoft SQL Server 2008 R2 SP1 Native Client, go ahead and restart SharePoint 2013 prerequisite installer. Now SharePoint 2013 prerequisites should install successfully.

Top 10 Tips for Using PowerShell ISE

PowerShell logo

Microsoft’s ISE is free and is more or less the de facto Microsoft PowerShell development tool

If you’re just getting started with PowerShell, chances are you’ll be doing your work in the Integrated Scripting Environment (ISE). Although there are many third-party products that improve upon the features of ISE, Microsoft’s ISE is free and is more or less the de facto Microsoft PowerShell development tool. Sure, you can edit your PowerShell scripts in just about any text editor, including the venerable Notepad, but ISE is a much more productive tool, providing you with the ability to use IntelliSense and color-coded syntax as well as editing, executing, and debugging PowerShell scripts. In this column, I’ll show you 10 tips to make your PowerShell development in ISE more productive.

1. Put ISE on the Windows 8 Start Screen—Although PowerShell 3.0 and PowerShell ISE are both delivered out-of-the-box on Windows 8, there’s no PowerShell ISE option on the Windows 8 Start Screen or desktop, and if you search through Apps you won’t find it. That doesn’t mean that PowerShell ISE isn’t there. It’s hidden on the Administrative menu, which isn’t displayed by default. To add the Administrative menu and the PowerShell ISE option to the Windows 8 Start Screen, open the Windows 8 Settings charm, choose the Tiles option, then move the Show administrative tools slider to Yes.

2. Set the Execution Policy—Oddly, although ISE is clearly oriented toward developing scripts, it does nothing to change PowerShell’s default script execution policy, which doesn’t allow scripts to run. The default PowerShell execution policy is set to Restricted. To allow ISE to run PowerShell scripts, go to the Console pane and enter the following command:

Set-ExecutionPolicy RemoteSigned

3. Open Multiple Tabs—One of the things that makes ISE so much more powerful than Notepad is that it lets you open multiple tabs and work on multiple scripts at the same time. Unlike Notepad, it doesn’t isolate you in a single window. You can approximate this functionality with multiple Notepad windows, but then you lose out on the color coding, IntelliSense, and code snippets. To open multiple tabs, use the File, New option or the File, Open option, and ISE will open a new tab in the Scripting pane.

4. Use Snippets—If you’re not a developer, you might not know what code snippets are all about. Code snippets are prebuilt code blocks that you can insert into the Scripting pane to give you a head start in writing the correct PowerShell code. For example, if you want to use an If-Else statement but you don’t remember the exact syntax, you can simply position your curser where you want the If-Else statement to start and then press Ctrl+J or select Start Snippets from ISE’s Edit menu. Doing so will display a dialog box with all the available snippets. As you scroll through the dialog box, a tooltip displays the actual PowerShell code that will be inserted.

5. Use Code Regions—Another feature that ISE provides to help you navigate your code is regions. Regions are collapsible sections of code indicated by a minus sign and an outline marker on the left side of the Script pane. ISE automatically creates regions for block structures, such as If-Else, For-Next, For-Each, and While loops. You can also create your own regions by marking the start of the region using the #region tag, optionally followed by a name. You mark the end of the region by using the #endregion tag. A closely related feature is PowerShell’s automatic brace matching. If you select a brace or parenthesis, ISE will automatically highlight the matching brace or parenthesis.

6. Use F1 PowerShell Help—As you might expect, ISE provides a lot of help for people who are just getting started with PowerShell. The Command Add-In pane on the right side of the screen can help you see the valid parameters for the various PowerShell cmdlets. The built-in F1 Help goes further by displaying a graphical pop-up window displaying Help for a selected PowerShell cmdlet. You can take advantage of the pop-up F1 Help by simply moving your cursor over a cmdlet that you want to display Help for and pressing F1.

7. Run Code—Although it might not be as full featured as some of the third-party PowerShell development products, ISE is completely capable of running and debugging PowerShell code. To run just part of a script, highlight the text you want to run and click the Run Script icon or press F5. Doing so will run just the selected code. To run the entire script, click the Run Script icon or press F5 without making a specific code selection. You’ll see the results of the PowerShell code displayed in the Console pane.

8. Set Breakpoints—For a serious script developer, one of the most important features in ISE is its integrated debugger. You can use breakpoints to stop the execution of a given PowerShell script on a specific line. Breakpoints can be set on lines or variables. To toggle a breakpoint on a line, right-click on the line where you want the code execution to stop, then select Toggle Breakpoint from the context menu. Alternatively, you can click on the line and select Toggle Breakpoint form the Debug menu. You can also use the PowerShellset-psbreakpoint and get-psbreakpoint cmdlets to set and view breakpoints. You can’t set breakpoints on comment lines.

9. Single Step with the Debugger—Just as important as setting breakpoints is the ability to track the execution of your code by single stepping through the code. Single stepping though your code can help uncover logic problems that the code might have. The easiest way to single step is to press the F10 key after the code has halted on a breakpoint. You can also select Step Over from the Debug menu. If you have looping structures or functions that you want to step through, you can use F11 or Step Into from the Debug menu. Shift+F11 or Step Out will quickly exit the loop or function.

10. Examine Variables—Although stepping through your code is a valuable tool for uncovering logic errors, the ability to display the contents of variables is just as important. To display the contents of a variable, simply hover the mouse over any occurrence of the variable in the Script pane. You can also go to the Console pane and type in the variable name and press Enter. Of course, the execution of the script needs to be paused when you display a variable.

Ref : Windowsitpro

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