Monday, October 22, 2012

Setting up SharePoint 2013 Development Environment – Part 2

This is the Part 2 of the series for setting up a development environment for SP 2013 on a VM. As we know, this is the latest release for the new Microsoft stack of products that involves Windows Server 2012, SQL Server 2012, Visual Studio 2012 and SharePoint Server 2013 (or SP 15).

In this part 2, we will focus on Installing SQL Server 2012 on top of Windows Server 2012 that we installed on our VM.

- Start the Setup wizard for SQL Server 2012. Click on the “New stand-alone install…”.

image

Once you go through the steps of Updates for SQL Server, Setup Support Rules, License Keys and Accept Terms, you’ll need to choose from 3 different Setup Roles. I chose SQL Server Feature Installation.

clip_image002

On the next screen, Click [Select All].

clip_image004

Click Next. It should pass all the 3 Installation Rules as below:

clip_image006

Choose “Named Instance” and provide a name. Press TAB, this should update the Instance ID and all the 3 directory paths. Click Next.

clip_image002[4]

Click Next on the Disk Usage Summary.

Specify Service Accounts as created earlier for SSRS and SSAS. I’ll leave others as is (as a best practice, in prod environments, you may want to specify the service accounts for others as well).

clip_image004[4]

Click Next.

Leave the Auth Mode = “Windows” and click [Add Current User]. Click Next.

clip_image006[4]

clip_image008

Click Next. Then Click [Add Current User] to specify which user has permissions for the distributed replay controller. Click Next.

Specify controller name and leave the directory locations as is. Click Next.

clip_image010

Click Next. Then Click Next again on Error Reporting. It should be something like:

clip_image012

Click Next and then Install. Wait for the setup to complete.

clip_image014

clip_image002[6]

clip_image004[6]

clip_image006[6]

clip_image008[4]

This completes the SQL Server installation with SSRS (SQL Server Reporting Services) configuration in Native mode only.

At this point of time, let’s take another snapshot of the VM and do a windows restart.

So, that’s it for getting the basic SQL Server 2012 installed and running.

We will move to the Part 3 of this series, where we will get the SSAS with Tabular and PowerPivot for SharePoint Integration modes.

Saturday, October 20, 2012

Setting up SharePoint 2013 Development Environment - Part 1

Today I will be starting a fresh new series for setting up a development environment for SP 2013 on a VM. As we know, this is the latest release for the new Microsoft stack of products that involves Windows Server 2012, SQL Server 2012, Visual Studio 2012 and SharePoint Server 2013 (or SP 15).
I know there are a lot of blogs out there, already with many of these contents. My idea is to bring all those steps together in this series which will help me (or anyone else) try to begin exploring these new stack of products. (Note: It will be assumed that we have downloaded all the products required in this series.)

So here we begin:
Part 1: Installing Windows Server 2012. (You are reading this part.)
Part 2: Installing SQL Server 2012
Part 3: Installing SQL Server 2012 with SSAS with Tabular and PowerPivot for SharePoint Integration modes.
Part 4: Installing SharePoint Server 2013.
Part 5: Configure PowerPivot for SharePoint 2013 using the PowerPivot for SharePoint 2013 Configuration tool.

The first things first. As this is my virtual machine environment, you might need to trouble-shoot several other issues pertaining your local environment. As for example, network adaptor errors, connecting to internet on the guest machine, setting up the required services to run on the windows server, etc.
So, with these things in-place and working as per expectations (which normally does not in this real world), let us begin the part 1 now to get our OS installed.
- I will definitely say this was the easiest of all as it’s just about starting the setup and following the installation wizard to let the install step complete by itself. Once completed, you’ll get to see the Server Manager screen. Verify and make sure that the BITS Services is started. If not, start the service.
- Rename the Computer as per your liking. Do not restart at this moment. (This may lead to an error during the restart process while trying to update windows, and force an auto-reverting process.)
- Setup the windows auto-update and try to perform a manual check for recent updates. Download the updates and then restart and install updates. I saw that this process did avoid the auto-revert process while trying to perform certain updates.
- AD DS Configuration: Click [Add roles and features] on the server manager and click Next.
image
Select Role-Based or Feature-Based Installation. Click Next.
image
Click Next.
image
Select Active Directory Domain Services -> Then Click Add Features on the pop-up.
Click Next until you see the confirmation screen.
image
Select this check-box to auto restart after install completes, click Install.
image
Click Close.
image
Click on the Notification Icon and then click “Promote this server to a domain controller” (as “dcpromo” is no longer available in 2012).
Select “Add a new forest” and provide a Root Domain name (for ex: “ mydomain.com” without the quotes).
image
Now, it’s time to provide the restore mode password:
image
Click Next. As earlier, we will have to live by the DNS delegation warning:
image
Click Next on the Verify the NetBIOS Name assigned to domain.
Click Next on AD DS DB, LogFiles and SYSVOL.
Click Next on the Review Summary screen.
The install performs few prerequisite checks, shows the below success message (including few warnings):
image
Review the Results summary to verify if there are any major concerns for you to dig through.
I am happy with all that I see and click Install.
Once it completes, the server restarts.
The server aborted the restart, so I had to stop and then start the server manually.
Once it restarts, you’ll notice the domain in the username displayed:
image
You might also want to go ahead and install the Guest Additions to support the full screen display of the VM.
- Now let’s craete some user accounts. As this is just a Development environment, I will not be creating a separate account for each service applications as we normally do it for SP 2013. Instead I’ll simply create these two user accounts:
=> SSASSvcAcct: SQL Server Analysis Services Account.
=> SSRSSvcAcct: SQL Server Reporting Services Account.
=> SPConfigAcct: SharePoint Configuration Service Account.
Now, ensure that these accounts are added to “Domain Administrators” group.
At this point of time, let’s take a snapshot of the VM and do  a restart.
So, this is all for getting the OS installed and running.
We will move to the Part 2 of this series, where we will get SQL Server 2012 installed.


































Saturday, October 13, 2012

Creating a Countdown Feature based on List definition and Timer Job

In this post, I’ll be elaborating on some of the interesting aspects of SharePoint 2010 programming while trying to work on a project to create a countdown timer job for a visual web part packaged as a SharePoint feature. Some of these would include:

Part 1 - How to include the GUID generator in Visual Studio 2010. (This post)

Part 2 - How to create a Visual web part utilizing custom List Definition and List Instance without using Content Types.

Part 3 - How to include sample data with the List instance deployment.

Part 4 - How to create, deploy and utilize a Timer Job.

Before we jump into the List Definition, let’s first do a prep-work, much needed for the most of the Content development in SP 2010. Even though the GUID Generator can be accessed online here, I prefer to use it in my VS 2010 IDE.

- Start VS 2010. Go to [Tools] –> [External Tools].

- Provide the “Title” = “Create GUID”

- In the “Command”, click the “…” button next to it, and browse to the location “C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\guidgen.exe”.

- Click [Add] and then click [OK].

image

You should be now able to see an option to create GUID right from this Tools menu in VS 2010:

image

That’s it in Part 1 for our prep-work. I’ll start with the List definition in Part 2.

Saturday, October 6, 2012

Adding Content to a SP 2010 Master Page

 

There are situations when we need some external content to be displayed in the master page, and at the same time allow users to easily update this content without much hassles of code-changes to the master page. I went hunting for the same and eventually identified a few of them. Here’s a compilation of what I felt beneficial to all. Let me know, if you have more on your list.

#1. You can create a user control and insert into the Master page footer. Click here for more details.

#2. You can insert the webpart directly into the Master page footer. Let’s see how.

<table cellpadding="0" cellspacing="0" width="875" align="left">
  <tr><td>
      <WebPartPages:ContentEditorWebPart AllowClose="true" AllowEdit="false" AllowHide="false"
                    AllowMinimize="false" AllowRemove="false" AllowZoneChange="false" ChromeType="None"
                    ContentLink="/Documents/Footer.htm" ID="vha_simple_footer" runat="server"
                    __WebPartId="{9AADFFEC-FA65-4BB7-BAE6-4DA3A85A56A0}" WebPart="true"></WebPartPages:ContentEditorWebPart>
   </td></tr>
  </table>

#3. In case your site pages are all based upon few Page Layouts, you “might” place some ContentPlaceHolders on these page-layouts, and then add the footer code into a content editor web part on a page that is based upon the Page Layout. Refer this article from Bamboo Solutions for a complete details on creating a custom page layout for a Publishing Site using Visual Studio 2010

#4. You may also use “Reusable Content” in SP Publishing HTML fields to achieve the same. Find here.

#5. Then there are IFrames, the old ways of displaying a web page content. Well, I know, most of us would start a discussion around the SEO, when we talk about IFrames on the pages. But it still works and provides another way to get external content into a master page. (Although, I personally know, how powerful iframes programing can be. Check here.)

This is how to get this in place. Insert the below piece of code, in the footer section of the master page:

<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr><td>
       <iframe src="/Documents/Footer.htm" scrolling="no" frameborder="0">[Your browser does not support frames or is currently configured not to display frames. Please use an up-to-date browser that is capable of displaying frames.]</iframe>
</td></tr></table>

Next, upload the “Footer.htm” file with appropriate code in the [Documents] document library of the root site. I have a sample code for this file as:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head></head>
<body>
<div align="center"><span style="font-size:10pt">External footer content example</span></div>  </body>
</html>

I agree, this one is not the best of the practices, and I would advice not to consider this as a first hand solutions when other options might be more suitable for similar scenarios.

Sunday, September 23, 2012

Site Image Logo in SP 2010

 

Seems very simple, when it comes to setting up a Logo Image for your SP 2010 Site and its sub-site.

Use the LogoImageUrl to set the path of the image (say in “Layouts” folder) in the <SharePoint:SiteLogoImage> as seen below:

<SharePoint:SPLinkButton runat="server" NavigateUrl="~sitecollection/">
             <SharePoint:SiteLogoImage LogoImageUrl="/_layouts/mysitename/my_site_logo.gif" runat="server"/>
</SharePoint:SPLinkButton>

But things get a little complicated, if a Site Admin sets a different image in the [Site Settings] – [Title, Description and Icon] under “Look and Feel”.

image

It seems that this property tends to override the master-page LogoImageUrl in the <SharePoint:SiteLogoImage> as shown in the code above.

So the Solution:

- Clear the [Title, Description and Icon] field under “Look and Feel” section in [Site Settings]. I mean set it to blank or update it to the same image as set in the master-page.

But what if you have 100s of sites/sub-sites (in my case, there were 1500 sub-sites).

Power-shell to our rescue….

PS script can help us do the update needed very conveniently. That’s why we all love PS in SP 2010.

So here it is. Simply replace your own site URL and the Image path and run this script.

$site = Get-SPSite http://www.mysitename.com
$site.AllWebs | foreach { $_.SiteLogoUrl = "/_layouts/mysitename/my_site_logo.gif"; $_.Update() }
$site.Dispose()

That’s all we need to do.Have a nice day !!!

Saturday, September 8, 2012

Custom 404 Page Not found in SharePoint 2010

 

Well, now that we have successfully upgraded the MOSS 2007 sites to SharePoint 2010, there was a slight change in the URL structure in the new environment. In 2010, the site collection was moved to the top root level, more details on how to do this can be found here, as described below:

MOSS 2007: http://www.domianname.com/sitename/Pages/Home.aspx

SP 2010: http://www.domianname.com/Pages/Home.aspx

The issues that were identified:

#1. Bookmarked URLs might break for current users.

#2. The embedded deep-links in various email notifications already sent, may not work anymore.

#3. The various links to many pages, made available on other sites may start breaking with a page not found error.

The quick resolution that was agreed upon:

To implement a generic, custom page that should be displayed each time a user hits a 404 page not found error. This page would have a generic message and a link to take the user back to the home page.

How we did this:

Step 1: Create a meaningful 404CustomPage in the Site-Collection

a. Open-up the site and create a new Web-Part page in the Pages Library. Call it :”MyCustom404.aspx”.

b. Note the page URL; it should be “/Pages/MyCustom404.aspx”.

c. Design the page as per the business requirements by inserting Content Editors and Image web parts.

d. Place a generic but meaningful text on a content editor along with a link pointing back to, say, Home page.

Step 2: Create the Web Config Entries for the Web Application

a. Open-up the web-config file for the web application.

b. Create an entry for <httpErrors> section within the <system.webServer> as below:

<httpErrors errorMode="Custom" existingResponse="Auto">

<remove statusCode="404" subStatusCode="-1" />

<error statusCode="404" prefixLanguageFilePath="" path="/Pages/MyCustom404.aspx" responseMode="ExecuteURL" />

</httpErrors>

c. Save the config file and do an IISRESET.

Now go back and try to browse to a non-existing page on the site and you should see the custom 404 page being displayed.

Improvements that I can think of:

1. We can have a redirect logic on our custom 404 page to programmatically fix the url and redirect the user to the new page url.

2. We can also create a SP 2010 Solution package to automate the process of updating the web config file. This really helps in a multi-environment deployments by the admins.

I hope to get this improvements in-place in the next couple of weeks. I’ll update this post with the link to my new post so till then, have a nice time.

Sunday, August 26, 2012

Office 365 Enterprise Preview & SP 2013

So….now we are all talking about Apps in SharePoint 2013 and its integration with Office 365. Well it’s all about developing in the “Cloud” and more like what we are used to hear about SharePoint Online, Apps, Agave, Napa, etc.…..

Microsoft has introduced so many new terms that it is becoming really challenging for all developers (and for the whole SharePoint community) to keep pace with the whole new stack of new technology. So you might be wondering…what are we trying to come out with here!

Well….I am going to simply bring some basic concepts of “Getting There”. Not try to deal all at once and confuse you all, lets try to begin with Office 365.

First of all we need to have an account to start using this. Microsoft has this Office 365 Registration Form where you can get an account created quickly. And this being the “Enterprise Preview”, you have the leisure of using it until the Preview is made available by Microsoft.

Once you have your account setup, your Dashboard should look like this:

image

Click on “service settings” from the left navigation. This will bring up a new top navigation bar, click “sites”. On the next page, click “Create site collection”.

image

Click OK and you’ll be taken to the below SharePoint Administration Center page:

image

If we open the first URL in the Site Collections, which should read something like: https://yourcompanyname.sharepoint.com

And because you are the Administrator of this site, you can see the Home page of your site.

image

Disclaimer: The steps mentioned in this post are for the “Office 365 Preview” only. Things are expected to change and may not be the same after the Preview ends and Microsoft moves on to a new release.

So this is all in this part. I’ll talk more about how and what we can do with the available Apps and Downloads sections that we see here.

Saturday, August 25, 2012

Conditional Javascript in QuickLaunch bar

 

This is a great help !

The ability to display some conditional pop-ups/dialog boxes to the end-users when they click on various links on the Quick Launch bar items, seems a great idea.

I was looking to present a message to the users, whenever they clicked a certain hyper-link on the left navigation.

I wanted them to understand, that they are navigating away from their current site to a page url that might be externally hosted.

This is what really helped me do the same:

javascript: if(confirm(‘You are being re-directed to a site hosted externally. Click OK to proceed, Cancel to stay on the page.’)) document.location=’http://www.bing.com’;

Note: The above line of code being typed in a single line.

Thanks to my colleague Mike Smith for posting this trick with many other options as well.

Friday, December 23, 2011

Deploying SSRS 2008 Reports to SharePoint 2010 sites in Integration mode

 

Scenario: We have SSRS 2008 R2 configured for SharePoint 2010 Integration mode.

Requirement: We as a BI Developer, need to develop and deploy the reports to the SharePoint sites.

Walkthrough:

Step 1: Fire up BIDS – New Project – Select “Report Server Project” from the templates – Name the project “MyFirstReport” – Click OK.

Step 2: Let’s create the Shared DataSource. Right click the [Shared DataSources] in Solution Explorer and click “Add New DataSource” – Fill the [General] Section with the Name=”DataSource1”, Type=”Microsoft SQL Server” and edit the ConnectionString. We’ll select “Use Windows Auth” to connect to our DB for this example (This may vary based upon your Authentication mechanism).

Leave the [Credentials] Section with “Windows Auth” selected. Click Okay and you should see the DataSource1.rds created in the Solution Explorer.

Step 3: Now let’s create a report. Right click the [Reports] in Solution Explorer and click “Add New Report” – Go through the Report Wizard using the DataSource1.rds that we created earlier – Build your query by adding the appropriate tables – Select your Report Type (Table/Matrix, I’ll select Table) – Design your Table (I added all fields to the Details section) – Choose Table Style (Corporate) – Finish the wizard by naming the report “Report1”. You should see the Report1.rdl in the Solution Explorer.

Step 4: At this point, you can build the report and switch to the preview tab to view the report.

Step 5: It’s time for deploying our reports. Quite simple, just right-click on the project and deploy (if you want all the datasources and reports to be deployed in one go, else you can deploy them individually). Okay, right-click and deploy, uh Oh ! what happened. This is not what we wanted to see.

image

Okay, we never provided the SP Site URLs. Also, we need to make sure and plan where will our Datasources and reports should be deployed on the site.

Step 6: So let’s create the Document Libraries, one for Datasource and another for Reports. Browse the SP site and create them now. I created the following: [DataSources] and [Reports] without the braces [ ].

Step 7: Now, let’s get back to our BIDS project. Right click on the project and choose Properties. There you are, if you see the values there, they are the default values for SSRS in Native Mode.

image

So we need to change them to comply with our needs. Modify them as shown here:

image

Ok now that looks better. Let’s try to deploy again. It should do just fine. Browse to the “Reports” library on the site and click on the

You should be able to see the report.

Thursday, December 22, 2011

Configuring Anonymous access on SP2010 sites

The steps involved in enabling anonymous access to a SharePoint 2010 site are very similar to what we have been doing in MOSS 2007, so I won’t go into details of everything and do a quick walkthrough for achieving the same in SP 2010.

So here are the basic steps:

Step 1: Create the Web Application and the Site Collection.

Step 2: Select the Web App in [Manage Web App] section.

Step 3: In the ribbon, click [Authentication Providers].

Step 4: You’ll only see the “Default” zone, if you have just followed my instructions above and have not extended to any other zone. So, click the Default from the list.

Step 5: Select the check-box for [Enable Anonymous Access] and leave the [Windows Authentication] section as it is. You want this to sign-in using your AD account and grant access for “anonymous” users in the next step. (You may also want this to let you make additions/modifications to the site later.)

Step 6: Click Save.

Step 7: Next, login to your site using your AD account as the Site Collection owner.

Step 8: Go to [Site Permissions] – [Anonymous Access] on the ribbon – Then select “Entire Site” – Click “OK”.

Step 9: Once you are done with all changes/updates to your done, follow the Steps 2 through Step 5 again and uncheck the [Windows Authentication] and Click Save.

Step 10: You might get the error “401”, if you try to refresh the page after Step 9. In this case, clear your cache, close all the browser instances and try again. You’ll be able to get to the site without any login prompt.

So there it is. In just 10 steps you have been able to setup an anonymous site.