Categories: MOSS 2007 Posted by TK on 6/8/2010 3:28 PM | Comments (0)

Page copy protected against web site content infringement by Copyscape

I was going through the steps of deleting content db using stsadm (as you know it does not delete the content database from SQL Server, but just removes the reference from SharePoint perspective) and using stsadm –o addcontentdb to attach a content database from production to development server for testing purposes. Once the stsadm –o adcontentdb operation was completed successfully, I went into Manage Content Databases section and noticed the Current Number of Sites was set to 0.

 

image

To confirm that the content database had some valid entries for webs and sites, I queried the following tables

select * from Sites with (nolock)

and then the webs table

select * from webs with (nolock)

 

The query results showed entries existed in the sites table as well as the relevant webs table. After further troubleshooting, the issue was caused by GUID conflicts in SQL Server. I had restored the same content database from production to development server few months back for some other testing purpose to a different web application. Although this was a brand new web application that I had created, the GUID conflict still occurred and that is the reason the number of sites was set to 0. So, to ensure that the restore process was clean, I started the restore process again on SQL Server, executed stsadm –o deletecontentdb for the new web application I had created followed by stsadm –o addcontentdb pointing to the new database restored.

Now, if you have a question, so how do I maintain 2 copies of the same content database in production in this scenario without GUID conflicts? You can use stsadm backup and restore (or) content deployment. I did try with stsadm backup and restore and the process was successful.

Hopefully, this post will save you some time next time you encounter a similar situation.

Categories: MOSS 2007 Posted by TK on 5/14/2009 4:38 AM | Comments (0)

Page copy protected against web site content infringement by Copyscape

 

I am sharing with you the SharePoint Governance poster that I show my clients to give them an overview of different areas in SharePoint Governance. This is a very high level view of SharePoint Governance but is a good starter to get the discussion rolling. Hope this helps!

 

SharePointGovernance

 

If you are starting out on SharePoint Governance (or) already into it, the codeplex material is a good read:

http://www.codeplex.com/governance

Categories: MOSS 2007 Posted by TK on 4/9/2009 5:59 AM | Comments (0)

Page copy protected against web site content infringement by Copyscape

In some cases, it may be useful to query the existing Content Types in your site collection that have an associated Workflow defined. Use this query to loop through your content types and find the ones that have workflow enabled.

         string siteCollectionName = "http://devsite";
            SPSite siteCollection = new SPSite(siteCollectionName);
            SPWeb site = siteCollection.OpenWeb();
            foreach (SPContentType contentType in site.AvailableContentTypes)
            {
               if ((contentType.Group.ToString() != "_Hidden") && (contentType.WorkflowAssociations.Count > 0))
                Console.WriteLine("Content Type Name: " + contentType.Name.ToString() + " Content Type Group: " + contentType.Group.ToString());
               
            }
            Console.WriteLine("Press any key to continue....");
            Console.Read();

I am filtering out the hidden groups and using the WorkflowAssociations property to track the content types that have workflows associated with them.

Categories: MOSS 2007 Posted by TK on 4/2/2009 7:31 AM | Comments (0)

Time for April 2009 Code Camp.

If you are in the Philly area, you should plan on attending. There are about 60 sessions and all of them are free.

I will be doing a session on SharePoint 2007 HA (High Availability). Will discuss about WFE(Web Front End Servers), NLB (Network Load Balancers) & SQL Server HA (Clustering, Mirrorring).

Follow the link

http://codecamp.phillydotnet.org/2009-1/Lists/Sessions/DispForm.aspx?ID=17

Join in and see you there!

 

 

Categories: MOSS 2007 Posted by TK on 1/14/2009 2:25 PM | Comments (1)

Page copy protected against web site content infringement by Copyscape

This post will outline how to configure search in MOSS 2007 so that search results do not crawl other site collections and how to use Search Scopes to implement this.

If you search on the web, you will find numerous articles on general MOSS 2007 Search configuration. So, I am not going to repeat that here. My goal is to help you understand Search Scope in MOSS 2007 and restrict crawl results against other site collections.

Scenario:

  • SSP (Shared Services Provider) was configured in Central Administration using standard settings.
  • Web application is created on Port 80:  http://dev1
  • Root site collection (named "Dev Portal") is created on dev1 using publishing site template.
  • Using Central administration a managed path with name "finance" is created.
  • Site collection (named "Finance Portal")  is created on the managed path (http://dev1/finance)  using publishing site template.

Requirement:

If you search on Dev Portal, the results returned should be confined only to Dev Portal site collection and not the site collection present under Dev Portal(i.e. no results from Finance Portal) and vice versa.

Approach:

I searched for a keyword "scott" on my Dev Portal and this is the result I got

image

As you can see, I have 2 listings (one from the root site collection -- Dev Portal and the other from site collection created on the managed path -- Finance Portal)

Now, let me perform the same search on the Finance Portal

image

Ok, so now let us go about creating search scope and confining the search results only to the respective site collection.

1. Navigate to Site Actions -- Site settings -- Modify all site settings in the Dev Portal

2. Select "Search Scopes" under "Site Collection Administration"

3. In the window that displays, select New Scope

search_Scope3

4. Type in the name of the scope as shown and check the Search Dropdown & Advanced Search check boxes. These are the standard display groups.

search_Scope4

5. Once the new scope is created, add new rules to the scope.  The first rule is shown in the screen shot below. This rule ensures that finance site collection is excluded from the search performed in the Dev Portal

search_Scope5

6. Add one more rule and in this rule, add the root site collection and set the Behavior to "Require" as shown in the screen shot. When you are done with setting the rules, the compilation will take place as per the schedule. Let the compilation finish.

search_Scope6

7. Click on the "Search Dropdown" option on the View scopes screen and make the changes shown in the screen shot. I have unchecked "All sites" and "People". You can keep them based on your requirement.

search_Scope11

Repeat the same settings for "Advanced Search"

image

8. Now we are done with the Search scopes screen. Perform any type of search on Dev Portal so that the search results page is display. Click on Site Actions -- Edit Page and select the "Search core results" web part.

search_Scope8

Select edit -- Modify shared web part and under Miscellaneous section, set the scope to "Dev Portal Search Scope". Re-call that this is the name of the new search scope we had created.

search_Scope9

Click "Ok", check-in, publish, approve the page.

9. Now, go back to Dev Portal home page and perform the search again for the keyword "scott" and you will see that only search result is retrieved and it is confined to only the "Dev Portal" site collection.

search_Scope10

10. You can repeat the same steps for "Finance Portal" site collection with the exception of Step 5.

Hope this posting helped you understand the concepts of Search Scopes and how to utilize them to confine search results to specific site collections.

Tags: | Categories: MOSS 2007 Posted by TK on 1/11/2009 12:11 PM | Comments (0)

Page copy protected against web site content infringement by Copyscape

Let me discuss about Single Sign-on (SSO) functionality in MOSS 2007.  This is a very useful feature in MOSS 2007 that lets you interact with external data in a secure manner.

I have seen many useful blogs that give you introduction to MOSS 2007 SSO. I am going to try to differ a little bit by walking you through basic steps of configuring external data sources and accessing the data using a web part in MOSS 2007.

Why do we need to use MOSS 2007 - Single Sign-On (SSO)?

MOSS 2007 SSO facilitates securely accessing external data sources from MOSS 2007. The major advantage with using this approach is all external data source credentials passed to MOSS 2007 are encrypted and just plain text. You may be accessing ERP systems like Siebel, SAP which may in turn be using any databases and you don't want to be passing your login credentials without encryption. Further, BDC can be configured to use SSO to access external data securely.

In our example, we will access a SQL Server database. For demo purposes, I have created a SQL Server 2005 database named "SSODemo". I have one table named "Customer" with 2 columns "CustomerName varchar(50)" & "CustomerPhone varchar(12) and a user with username "ssoDemoUser" has necessary privileges to access the database and perform DML operations.

Step 1: Navigate to Central admin -- Operations -- Manage Single Sign-On (should be listed as the last option under "Security Configuration" section )

If you get an error message on the screen which says

"Failed to connect to Microsoft Single Sign-on Service. To configure, please ensure the service is running"

go to Services and start the "Microsoft Single Sign-on Service" and refresh the Manage Single Sign-on page.

2: Select Manage server settings under Server settings

image

3: Enter all required information in the "Manage Server Settings for Single Sign-On".  and submit the form.

image

If you get an error message which says "You don't have rights", go back to the services and change the Logon credentials for "Microsoft Single Sign-on Service" to the exact domain account you will be using for the "Account name" shown in the screen shot.

Once the submit is successful you will be redirected back to the main screen. You will now see the "Manage encryption key" link enabled. If you click on it, you will be able to create,backup and restore encryption keys used in SSO operations.

4: Next step is creating a new Enterprise Application Definition. Click on "Manage settings for enterprise application definitions" and then "New Item"

sso_serversettings3

5: Fill in the information as shown in the screen shots below

image

image

Note that username and password are 2 login credentials that we need apart from the datasource (which we will define using Share Point Designer -- SPD) to access the SQL Server database. In terms of external ERP systems, you can define all the login elements required in this screen. Once you have entered all the information, submit the form.

6: Next option is to set up account information. (select the 2nd option under "Enterprise Application Definition Settings). The screen that loads will enable you to setup new account information. I had created a domain group called SSO Users, but you can use any valid group in your domain.

image

On the next screen, we enter our SQL Server username and password. Recollect that I had created an user named "ssoDemoUser"

image

Select "Done" on the next form.

7: Next is configuring the data source using SPD.  In SPD, open Data Source Library under Task Panes and select Database Connections -- Connect to a database.

image

Select Configure Database Connection

image

In the Configure Database Connection, key in the server and for authentication select SSO

image

In the Single Sign-On settings, key in the following information (DemoSSOApplication was the application name we defined in the enterprise application definition)

image

If the connection is successful, you will see the next screen where you can pick the option to run a SQL command or stored procedure.  Select the "specify custom Select" option to enter custom queries.

image

Select "Edit Command" button to enter a SQL statement

image

Select "OK" to all other forms.

8: You will now see a "Custom Query" section under

image

Drag and Drop the Custom Query to any page in your site. Check-in and Publish the page. You will now be able to see a web part displaying the query results from the database.

image

Pretty cool?

This is just a basic demo of showing MOSS SSO features. It is a powerful feature within MOSS 2007 to access disparate data sources securely.

Categories: MOSS 2007 Posted by TK on 9/9/2008 8:12 AM | Comments (0)

Page copy protected against web site content infringement by Copyscape

MOSS Site Navigation - Obtain Page layouts programmatically 

Here is the code snippet that will help you obtain the site navigation structure of an existing site (this will be useful when you are trying to automate deployment of site structure to the target server)

Assuming web is of type SPWeb, SW is StreamWriter that writes to a xml file

 PublishingWeb pubWeb = PublishingWeb.GetPublishingWeb(web);
            
   try
      {
          if (PublishingPage.IsPublishingPage(pubWeb.DefaultPage.Item))
          {
               SW.WriteLine("<page site=\"");
              \\ this will give you the site page name
              SW.Write(web.ServerRelativeUrl.Remove(0, 1));
              SW.Write("\" pagelayout=\"");
              \\ this will give you the Page layout name
              SW.Write(PublishingPage.GetPublishingPage(pubWeb.DefaultPage.Item).Layout.Name);
              \\ this will give you the Page title
              SW.Write("\" title=\"");
              SW.Write(pubWeb.DefaultPage.Title); 
              SW.WriteLine("\" />");

  
           }
      } 

I have left out the exception handling part and other detailed code. This is just to give you an idea about the methods available with the PublishingWeb object that will fetch you the site names/page layouts/title details.

Remember, this code snippet has to be called recursively for each SPWeb available under SPWeb.Webs

 

 

Categories: MOSS 2007 Posted by TK on 7/14/2008 4:03 AM | Comments (0)

Page copy protected against web site content infringement by Copyscape

You may come across situations where you need to add custom styles (css) to edit text inside your content editor web part. To enable custom styles to you web part, open your master CSS file used for your site and add an entry that follows the naming convention of

.ms-rteCustom-xxxx

where xxxx is the custom name of your style.

Note: When you add custom style entries to your CSS file, the content editor will override the existing styles (ArticleByLine,ArticleHeadline,ArticleTitle) and only show the custom styles you had created.

.ms-rteCustom-SampleTitleByTK

{   

font-weight: bold;

font-family: Arial   

font-size: 14pt   

color: #8F2031;   

text-transform: capitalize;

}

Once this link is added, you will see the option available in your content editor web part as shown below

 

Categories: MOSS 2007 Posted by TK on 6/21/2008 10:44 AM | Comments (0)

Page copy protected against web site content infringement by Copyscape

I had a requirement to show the top 3 of news listing on the home page with the option of having these links open up in a new window.

First read these 2 good articles

http://blogs.msdn.com/ecm/archive/2006/10/25/configuring-and-customizing-the-content-query-web-part.aspx

http://www.heathersolomon.com/blog/articles/customitemstyle.aspx

Now, when it comes to locating the internal name and the field type, you may encounter some issues. Refer to Heather Solomon blog where she has some pointers.

1) Create a site column named "OpenInNewWindow" and make that a choice type with values "true" and "false"

2) Create all other site columns as required.

3) Include the site columns in your custom list.

4) Edit ItemStyle.xsl and include the following lines in your template section

        <xsl:variable name="LinkTarget">   

<xsl:if test="@OpenInNewWindow = 'True'" >_blank</xsl:if>

        </xsl:variable>

 

You will then be able to use this variable in your <a href> reference target target="{$LinkTarget}"  

Once you create a new item in your list and set the OpenInNewWindow variable, the link will open in a new window if value is set to "true".   

Categories: MCMS 2002, MOSS 2007 Posted by TK on 6/7/2008 10:51 AM | Comments (0)

Page copy protected against web site content infringement by Copyscape

When you try to create a new migration profile in MOSS 2007 which connects to MCMS 2002, you may get a sql connection issue.

This is due to the fact that SQL Server 2000 was not set to Mixed Mode. If it uses windows authentication mode only, the migration assistant in MOSS 2007 will not be able to connect to the data source.

To change to Mixed mode, right click on the server name in SQL Enterprise Manager --> Properties and change to Mixed mode.