Wednesday 27 March 2013

Code-blocks are not allowed in this file: SharePoint 2013

By Default SharePoint did not allowed to inline code . this Trick will work for SharePoint 2013 , SharePoint 2010 and SharePoint 2007.

 To enable this open Web.config for particular site, and search for "PageParser" and Replace the Code with below code .. its simple you have to add Page parser paths , currently i put "/*" as Virtual path , you can use path according to your directory , Such as "/_pages/*"

<PageParserPaths >
<PageParserPath VirtualPath="/*" CompilationMode="Always" AllowServerSideScript="true" IncludeSubFolders="true" />


After that just create one testing page in SharePoint designer under site pages  and Put following code for testing

<%@ Page Language="C#" %>

<!DOCTYPE html>

<script runat="server">
    string test = "";

    protected void Page_Load(object sender, EventArgs e)
Response.Write("Code Block is Working ");

<html xmlns="">
<head runat="server">
<meta name="WebPartPageExpansion" content="full" />
    <form id="form1" runat="server">

then browse , it will work .

Attach master Page :

Select Style -> Attach -> and select master page that you want to apply.

you script will remove from that page. just copy your script code before apply master page.

After apply master page remove  <form id="form1" runat="server"> </form>  tags.

and paste your script in <asp:Content id="Content1" runat="Server" contentplaceholderid="PlaceHolderMain"> tag.

you final code for testing looks like below image:

Now Browse to see the Result and it will work.

Monday 25 March 2013

Add , Modifying and Delete Web.Config Entries in SharePoint 2010 Programatically

Add, Modifying and Delete Web.Config Entries in SharePoint 2010 Programmatically.
You can use SPWebConfigModification  class of theMicrosoft.SharePoint.Administration namespace, which allow to manage web.config entries.
And other way is WebConfigurationManager class.
I am using AppSettings Group to add and Edit the values and Using Visual Webpart.

To add new entry
Where key is String AppSettings new  Key and Value is value for Key
private void newEntry(string Key,string Value)
            Configuration Newentry = WebConfigurationManager.OpenWebConfiguration("~");
            Newentry.AppSettings.Settings.Add(Key, Value);

To Edit Entry
Where key is String AppSettings Key and Value is New value for Key.

        private void ModifyExisting(string Key, string Value)
            Configuration ModifyEntry = WebConfigurationManager.OpenWebConfiguration("~");
            ModifyEntry.AppSettings.Settings[Key].Value = Value;

To Delete entry :
Where key is String AppSettings Key.
        private void DeleteKey(string key)
            Configuration DeleteEntry = WebConfigurationManager.OpenWebConfiguration("~");

Get All Entries:
In this method I am using Grid View to show all items (key Value pair) in Grid view and also excluding SharePoint Default entries.
private void LoadAllKeys()
            NameValueCollection appSettings = ConfigurationManager.AppSettings;
            if (appSettings.Count == 0)
                lblmsg.Text += "AppSettings is empty Use GetSection command first. <br>";
            gvAllRecords.DataSource = appSettings;
            foreach (GridViewRow item in gvAllRecords.Rows)
                if (item.Cells[1].Text == "FeedCacheTime" || item.Cells[1].Text == "FeedPageUrl" || item.Cells[1].Text == "FeedXsl1" || item.Cells[1].Text == "ReportViewerMessages")
                    item.Visible = false;
Get Specific Entries
Simple method where Key is Appsettings key name
private string GetSpecific(string key)
               return String Value = ConfigurationManager.AppSettings[Key];

Friday 22 March 2013

Everything is fine, but we had a small problem getting your license.SharePoint 2013 Apps

I was try to Add Apps from SharePoint store, but I am unable to add it. I was getting below error message

“Everything is fine, but we had a small problem getting your license. Please go back to the SharePoint Store to get this app again and you won't be charged for it. "

I am using SharePoint 2013 on my local server. I configure everything correctly I rechecked, but nothing is working for me.

I was using system account or farm account. Then I use different account for it, it’s working for me.

The System Account cannot be used to get apps from the app store...

Thursday 21 March 2013

SharePoint 2010 Performance Point Score Cards using SharePoint Lists

Performance Point is Service and Part of SharePoint 2010 Enterprise Features, Used to analyze Data with in SharePoint, or other Source. SharePoint 2010 have Dashboard designer tool to Create dashboards, scorecards, reports, and key performance indicators (KPIs)

Easiest way to start the performance point is - Create Business Intelligence center or use existing Business Intelligence Site because it contain libraries to Store Performance Point contents.

It Contain following libraries

Dashboards Contains Web part pages, Web part pages with Status Lists and Performance Point deployed dashboards 

Data Connections Contains ODC, UDC and Performance Point data connections 

Performance Point Content Contains Performance Point items, including scorecards, KPIs, reports, filters, indicators, and dashboards 

Create SharePoint List for sample demonstration

In this example I am creating list with the name of Students Records using Custom List Template and Add 3 Custom Columns (year (Number), Enrollments (Number) and Target (number))
Add some testing records in it.

How to launch Performance Point designer 2010
Click at home page of BI Center

Select Create Dashboard - > Click at “Start using Performance Point Designer

Click at Run “performance Point Designer”

If you’re unable to lunch performance designer then please look at following article unable to launch Performance Point designer
Create Data Source:
Right Click on Data Connection and select new Data source

Select SharePoint List (you can choose any source currently for this demonstration we have SharePoint List)

Provide Data Connection/Data source Values
SharePoint Site URL -> Select All List -> and then choose particular list from all lists, Click Test Button to test your Data Source.

If you want to rename the Data connection select Properties Tab and Provide Different name.

To View the Data Select View tab and Press Preview Button at Right Corner. As we have year as Number Field so select year Column and in properties select Column type as Dimension.
Or you can skip this step if your year column is Single line Text.

Now Our Data Source or data Connection is Configured Properly, Next step is Creating Displaying item Type, for this example I am using Score card.         
Create Score Card
Right Click on Performance Point Contents -> New ->Score card

Popup will open to configure Performance Point Score Card. Select Tabular from Lift Category and select SharePoint List.

Select Data Source in Next Step

Press next and Click at Add KPI (if you have Existing KPI you can use by clicking at select KPI)

Rename the KPI and select Actual as (Enrollment), band method as (Increasing is better) and target as (Target) .and Press Next.

Next Add Filter option remains as default don’t change anything and press Next

Select members -> Check the Check box and press Select Dimension and Choose year

Select performance Point Content location, if you want to change the location then press browse button otherwise leaves it blank.

Press Finish

Your score card is Ready, now we have to deploy it in SharePoint Site, for this we need to Create One Dashboard.
Right Click on performance Point Contents -> new and Select Dash Board. 

Select the DashBoard page Template , For simple select "1 Zone" 

It will show 2 portion, one for page name and other for contents , if you want to change page name you can easily change page 1 to your desire name. and in DashBoard Contents area you can place contents that are available in Details section at Right corner. as for this example we have one score card so drag your score card from detail pane to DashBoard Contents area.

After that you have to deploy you dash board at SharePoint Site , Right Click at Dash board and select Deploy Option and in Next Popup window Choose Location to deploy, you can chose master page and Navigation option as well if you want to change

After Pressing OK it will automatically show results in browser.

Saturday 2 March 2013

Install Active Directory (AD) On Windows Server 2012 -Step By Step Guide

Till windows server 2008 r2 you can install Active Directory Using dc-promo Command , But for Windows server 2012 this command is not available , you can install Active directory using Power shell commands or by installation of Roles in Windows server Manager.
I will Follow the GUI Method to Install active Directory.

Open the Windows server manager for 2012. And Click on Manage  and Select Add Roles and Features Option.
Add Role for Active Directory
Select installation type as "Role based or Feature Based Installation " and Press Next to Continue

Select Server Destination Server "Select Particular server and Press Next"

Select server role "Active Directory Domain Services Role"  and Press Next to Proceed.

it will prompt for Features that are required for Active Directory Domain services Role. Click to add Features.

Below screen Shows some information about active directory  with message about DNS Server is required for Active directory.  Press Next to continue.

next step will show the details about Selected role and related features, press Install to Continue

Installation Progress screen will shown , it will take few minutes to proceed

 After installation Close the screen.

 you will notice on Server manager  that "Active Directory Domain service" are added at left panel, Click on it and it shows the Configure the AD-DS. and select the Add New forest  and provide your root domain name in text box. Click next to continue.

select functional level for domain and forest and press next

DNS Options will appear if delegation the select otherwise press  Next  to continue

Additional options for NetBIOS Name,(it will Automatically Populate based to you previous settings)

Select path for Database and Other folders if you want to change you can select other path , Default setting it will populate C drive path.

Review options that you select in previous screens, if any thing wrong you can select previous to change the settings. and also can view installation script by pressing View Script button. Select Next to continue.

Script Preview

Final Step and Review all Pre-Req and Press Install to finish the Installation, 

 After Completion your system will reboot.