Friday, January 7, 2011

Working with PowerShell “cmdlets”

Pronounced “Command-lets”, cmdlets are a great way of scripting Administrative tasks in SharePoint 2010. I personally feel that I was missing such a tool till last year working with MOSS 2007. But with cmdlets, it looks extremely promising that Microsoft has ultimately provided the SharePoint Administrators – a single platform to script their tasks and run commands remotely/locally.

Recently, I was trying to look into these cmdlets and here are some quick view into some of the most basic ones.

Interestingly, these cmdlets are in a format that resembles the verb-noun pair. The noun generally starting with a “SP” for all SharePoint cmdlets.

#1. Get-SPContentDatabase: This gives you a list of all the Content DBs in your farm, with information on ID, Name, Server and Site count.

Okay, now you must be thinking that I am going to get nasty by listing down all these cmdlets, uhh… you are definitely wrong.

Instead, I just figured-out how to retrieve a list of such SP cmdlets and also how to pull more information about each of them.

Get-Command and Get-Help can be really handy for anyone starting on these. Here’s an example of how to use the Get-Command.

Get-Command –PSSnapin “Microsoft.SharePoint.PowerShell”

Further-more, if you start creating your own scripts, you would also need to start using these two very often:

> Measure-Command: This gives you the cmdlets execution time.

> Trace-Command: gives you the ability for debugging short scripts.

Technorati Tags: ,,

Wednesday, November 10, 2010

Easily Import Visio Flowcharts as SharePoint Designer Workflows

So here is a another feature that makes you happier when you are using the SharePoint Designer 2010. The integration with Visio 2010 has been improved quite-a-bit. Now you can create your companies workflows diagrams as flowcharts in Visio 2010 and export the file, to consume/import it back in SPD 2010. Awesome! I like that.

So you must be thinking to get started right away……. but wait !!!

There are some pre-reqs to this. You need to have the Premium edition for Visio 2010. With this edition, you can find the specific “SharePoint Workflow” templates to start creating the flowcharts.

So buckle up – and lets start the tour.

#1. Open Visio 2010 Premium edition.

#2. Select “Flowchart” and then “Microsoft SharePoint Workflow” from “Choose a Template”. Select your own Units, I selected [US Units] and click Create.

image

#3. You will get to choose from a list of SharePoint Workflow Actions, Conditions and Terminators.

image

This can then be very easily exported as a .vwi (visio workflow interchange) file which can be imported in your SharePoint Designer workflows and vice-versa too.

So have fun with SPD 2010 workflows.

Tuesday, November 9, 2010

Configure Reporting Services with SharePoint 2010

This post is in continuation from this post, where we saw how to proceed with this install and configuration when we already have the DBEngine, Analysis Services, etc installed on a SQL Box except for the Reporting Services.
Here, I proceed from where we select the Reporting Services Configuration Manager from the Configuration Tools.
image
Start the Reporting Services Configuration Manager and find your server/instance.
image
Click connect and you will see the next screen:
image
Follow the screens depicted as below to complete the rest of configurations.
image
image
image
image
image
image
image
image
image
image
image
I skipped the Report Manager URL, Email Settings and Executive Account as it is not mandatory at this step.
image
Take the encryption key backup.
Scale-out Deployment was disabled.
Now go back to the Web Service URL and Click Apply.
image
Next, you need to configure the Central Admin.
Go to CA –> General Application Settings –> Reporting Services Integration
image
And that should be all.

Update: Dec 23, 2011
If you need to read more about some of the requirements for running SSRS in SharePoint Integrated mode, visit this MSDN article.

And this Technet details much about SSRS Integration in SP 2010.

Thursday, October 28, 2010

Install the SharePoint integrated mode default configuration option is disabled while configuring the Reporting Services on SQL Server 2008 R2

I had a SQL Server 2008 Standard edition setup for the DBEngine and Integration Services. For some reason I did not install the Reporting Services at that time. Now I was trying to get the Reporting Services (RS) deployed with SharePoint 2010 in the integration mode.

The first choice was to install the RS. I got started, but to my surprise I saw the first two options “Install the Native mode…” and “Install the SP integrated mode…” disabled. I only had the option “Install, but do not configure the report server.” available to me.

Man, where did I go wrong. This is what it came to me first. But after a little search, I realized that this happens if you try it installing after the initial installation. And that is what I was doing. So I decided to proceed. I did see some warnings but they were not of much concerns.

I had to start the RS Configuration Manager from the Configuration Tools option and the later setups were pretty much the same old way of going through the wizard steps.

So there I was. And as the next steps, definitely you need the RS Add-In on SP 2010 box and take care of the rest of standard CA configuration steps.

Tuesday, October 26, 2010

Cannot access a host named SharePoint 2010 site locally from the server

I had a SP 2010 site setup and access it from my client machines. I was able to perform all administrative tasks from CA when I decided to switch to the server box and use the same host url “http://sharepoint.mycompany.com” that I was using from my client machine.

Guess what, I was not able to login to the site and it kept prompting me for my userid/pwd.

After  much of looking around, found this useful article which seems to be pointing to the security measures put in place by Microsoft starting Windows Server 2003 SP1 and later. It essentially got the loopback check in-place to prevent Man-In-The-Middle (MITM) attack from malicious apps.

You can read more about is here.

Thursday, October 21, 2010

Fab 40 Templates for SharePoint 2010

The news that Microsoft was not going to upgrade these Fab 40 templates has been giving jitters to quite a bunch of people like me, as we were already using them in MOSS 2007 and needed to upgrade with SP 2010.

But fortunately enough, TechSolutions has come for rescue.

These guys are making the upgraded versions available as and when they are getting ready. You can find the different versions as below:

Fab 40 Templates for SharePoint Server 2010

Fab 40 for SharePoint Foundation 2010

Keep watching them, if you do not find one you are looking for.

SP 2010 List does not exist - error

I was getting “List does not exist error” while accessing any list or doc library. It said something like this below:


The page you selected contains a list that does not exist.  It may have been deleted by another user.

=======================================================

Troubleshoot issues with Microsoft SharePoint Foundation.

Correlation ID: 9067ed55-d26c-46a7-84d6-7c1838441992

Date and Time: 9/14/2010 4:12:33 PM

<- Go back to site

=======================================================

Got this resolved. Actually, there was no proper AAM for the corresponding DNS entry for the Intranet zone.

Technorati Tags: ,,,

Friday, September 10, 2010

Choosing the correct site template in SharePoint 2010

This is a great compilation of various Sub-site templates (the new and deprecated ones) as well as available Lists and Pages in SharePoint 2010.

Todd has done it again in 2010 here as he did it in 2007 here.

Monday, August 16, 2010

How to enable a List to allow sorting on its class attributes

In my earlier post here, I had tried to convert a List to a DataView, in order to display a tabular result format in an asp:ListView control.

Once I got to display the table, I needed to sort the display based on CustomerID field of the Class “Customer”.

Thanks to Anand Malli, for having a great post on the Code Project for describing it beautifully and in a very simple, extensible manner.

Here is what I landed up doing:

Step #1: Inherited my class from IComparable

public class Customer : IComparable<Customer>
Step #2: Implement the IComparable member
public int CompareTo(Customer other)
{
throw new NotImplementedException();
}
Step #3: Add the Comparison member to the class
public static Comparison<Customer> CustomerIDComparison = delegate(Customer p1, Customer p2)
{
return p1.CustomerID.CompareTo(p2.CustomerID);
};
Step #4: Finally, getting the sort to work before setting the DataSource of the ListView.
lstCustomer.Sort(Customer.CustomerIDComparison);
And that’s it. A big thanks to Anand for sharing this information.
Technorati Tags: ,,,

Convert a List to a DataTable or a DataView

Let’s say we have a class Customer, defined as:

public class Customer
{
public string Name { get; set; }
public string Address { get; set; }
public string ContactNumber { get; set; }
public int CustomerId { get; set; }
public string Email { get; set; }
public string CustomerType { get; set; }
}
Now, let us try to instantiate an object type <List> from this class.
List<Customer> lstCustomer = new List<Customer>();

And let us fill this with some data, I add just 2:
lstCustomer.Add(new Customer { Name="myName1",Address="1234 Spring Pike", ContactNumber="123-456-7899", CustomerId=1002, Email=”abcd@cc.com”, CustomerType="New" });
lstCustomer.Add(new Customer { Name="myName2",Address="1234 Spring Pike", ContactNumber="123-456-7899", CustomerId=1002, Email=”abcd@cc.com”, CustomerType="New" });

Now the actual action, let’s convert this List “lstCustomer” to a DataTable……

//#region Convert the List to a DataTable.

List<Customer> items = lstCustomer;
var tb = new DataTable(typeof(Customer).Name);
PropertyInfo[] props = typeof(Customer).GetProperties(BindingFlags.Public BindingFlags.Instance);
foreach (PropertyInfo prop in props)
{
Type t;
if (prop.PropertyType != null && (!prop.PropertyType.IsValueType (prop.PropertyType.IsGenericType && prop.PropertyType.GetGenericTypeDefinition() == typeof(Nullable<>))))
{
if (!prop.PropertyType.IsValueType)
{
t = prop.PropertyType;
}
else
{
t = Nullable.GetUnderlyingType(prop.PropertyType);
}
}
else
{
t = prop.PropertyType;
}
tb.Columns.Add(prop.Name, t);
}

foreach (Customer item in items)
{
var values = new object[props.Length];
for (int i = 0; i < props.Length; i++)
{
values[i] = props[i].GetValue(item, null);
}
tb.Rows.Add(values);
}

//#endregion
And finally, convert the Datatable to a Dataview
//#region Convert the datatable to dataview.

DataTable dt = tb;
DataView dv = new DataView(dt);

//#endregion
You may very well extract the conversion of a List to a DataTable into a separate method and pass the List “lstCustomer” to that method. I’ll leave the exercise for the rest who are interested to do so. Also, this is not a tested code, so please, no warranties… use it at your own responsibilities and make changes as you wish.
Technorati Tags: ,,,