Skip to main content

Ram's Blog

Go Search
Home
Blog
Events
About
  

RGOPINATHAN.COM > Ram's Blog
SharePointBlogs.Add(this)
MSDN Developer Conference
MSDN is bringing PDC to a city near you
check out this site and register, catch up on all the PDC action for less
 
 
SharePoint Blog Site: add post to socialbookmarking sites - javascript solution
So I Just recently signed up for an external WSS hosting and got my blog up and running. I wanted to have hyperlinks at the end of each blog post which would allow the reader to add it to facebook, digg or delicious sites. I searched online to see if there are any solutions and came across Mike Gannotti's blog post, this solution is really based on Mike's post I just made his solution better, also 3 images (facebook, digg, delicious) are downloaded from his site. So big shout goes out to Mike Gannotti.
 
If you are running sharepoint blog site here is how you can get this implemented to your sharepoint blog site
 
  • Download files here 
  • Extract the contents of the zip file and add it to a document library in your blog site
  • Add a formview web part to your sharepoint blog sites default.aspx page
  • Add a script tag to form view webpart with src referring to "SharePointBlogSocialBookMarkingutilities.js". This is a little technique I use to inject javascript into sharepoint pages without having to customize in SharePoint Designer. Here is sample markup from form view webpart in my site <script language="javascript" type="text/javascript" src="/Scripts/SharePointBlogSocialBookMarkingUtilities.js"></script>
  • Hide the formview web part so it's not visible in the page
Steps 3-5 need to be done for "Post.aspx" page as well. You also need to update the image urls for 3 images (facebook, digg, delicious) in the javascript file.
 
Enjoy! let me know if you have any issues getting this implemented.
PS: You can see this in action at the end of every blog post...
 
Data Layer Architecture Blueprint
Overview
data layer architecture blueprint is meant to provide architectural and process guidance to development teams building n-tier applications that connect to a backend relational database. This blueprint assumes you are using Microsoft SQL Server 2005 database, but that doesn't mean if your company is an Oracle shop you can't use it. You absolutely can as its completely tool independant and mostly architecture guidance.
 
Datalayer Architecture Blueprint
 
Key Design Goals
Following are the key design goals for this blueprint.
  • Control Access to Relational Tables, Data and other DDL components, appropriate change management procedures should be in place.
  • Logical seperation of Code & DDL components
  • Provide a sandbox for developers working in a team so that during development changes to stored procedure or table does not interfere with other developers in the team as well as break the application.
  • Improved security, when data access layer connection string is compromised, user can still perform operations that application allowed them to do and all data and DDL components are still protected.
Implementation Guidelines
Connect to SQL Server 2005 database and create three schemas.
  • ApplicationUsers Schema
  • Procedural Schema
  • Data Schema

Here is the T-SQL command to create Schemas in SQL Server 2005

CREATE SCHEMA ApplicationUsers AUTHORIZATION {user who will own the schema}

 CREATE SCHEMA Procedural AUTHORIZATION {user who will own the schema}

CREATE SCHEMA Data AUTHORIZATION {user who will own the schema}

Connect to the database as user that owns the "data" schema and create all the tables, constriants, triggers etc

Connect to the database as user that owns the "procedural" schema and compile all stored procedures, functions. Remember to request Database Administrator to grant necessary permissions on "Data" schema before compiling stored procedures, functions etc.

Create Application User, this is the user that data access layer components are going to use when connecting to the database. This user must be granted execute permissions on stored procedures in the "procedural" schema.

Also create Schema for each developer in your team. This acts as a sandbox for developer to make changes and grant execute permissions on stored procedures in "procedural" schema.

Script all ddl statements, as well as stored procedures and functions. Automate deployment of stored procedure and functions to "procedural" schema either through DB Pro or custom build script.

Scripts for ddl statements can be pushed to the "Data" schema by Database administrator.

When a developer in your team needs to make changes to objects in "procedural" schema or in some cases objects in "Data" schema (table changes, add new constraint etc). He/She would need to bring it into thier schema, test it. Once developement is complete check the scripts to source control and build process will push changes to stored procedures, functions etc procedural schema. Changes to objects in "Data" layer schema will be pushed by Database Administrator as stated earlier after appropriate change management procedures are complete.

Advantages
Meets all the key design goals like sepration of code and ddl components, improved security when data access layer user id is compromised, user can still only perform what the application allows. Provides sandbox environment for each developer in your team to work on database changes without impacting other developers.  
 
Disadvantages
Requires lot of DBA involvment. Requires developers knowledge how to write stored procedures, complex to maintain.
 

Would love to hear your feedback

 

Get Windows Live Widget For Your SharePoint Site

Here are the steps to get windows live messenger widget on your SharePoint site

·          Browse to this url http://settings.messenger.live.com/applications/CreateHtml.aspx with your windows live credentials

·          choose how you want to display messenger on your website

·          choose size and theme

·          copy the html

·          click on "Home" navigation link in web settings

·          check "Allow anyone on the web to see my presence and send me messages" option

·          click on "Save" toolbar button

·          Login to your sharepoint site

·          under "site settings" option select edit page

·          Add a content editor webpart and paste the copied HTML onto the content editor webpart and apply changes and thats it. 

Custom Stsadm command to backup/restore all site collections in batch for a web application

SharePoint comes with a command line utility stsadm for administrators to use to perform all admin operations on a farm. Out of the box commands backup/restore allows administrators to backup/restore site collections, if you have created many site collections in your web application, backing up those entire site collections individually can be a pain. Quick solution was to write a custom stsadm command that will take web application url and a backup directory root where all the site collection backup files should be stored, when the command runs it enumerates all the site collections in specified web application using the enumsites command and for each site collection found will call backup or restore command depending on the operation invoked.

Download Source Files here Download the SharePoint Solution File (wsp) here

Calling BDC entity methods using custom code
Since many of you by now know what Business Data Catalog is, I will spare your time by not trying to explain what BDC is. Instead in this post I do want to cover the BDC Wrapper class which wraps accessing BDC entity methods using custom code, makes calling BDC entity methods simple and easy to use in multiple projects. 
If you are doing custom work in your sharepoint projects there are several scenarios where you might choose to use BDC to retrieve data from a backend SQL Server database instead of trying to write custom code to connect to the database and retrieve data.
 
overloaded Constructors in the helper class allows you to initialize with or without a shared resource provider context.
  
public BDCHelper(string lobInstanceName):this(lobInstanceName, string.Empty)
{
}
//use this constructor when there is no shared resource provider context available
public BDCHelper(string lobInstanceName, string sspName)
{
            this._lobInstanceName = lobInstanceName;
            this._sspName = sspName;
     //set shared resource provider to use if current Office Server Context is null
            if (Microsoft.Office.Server.ServerContext.Current == null)
            {
                Microsoft.Office.Server.ApplicationRegistry.Infrastructure.SqlSessionProvider.Instance().SetSharedResourceProviderToUse(sspName);
            }
}
 

There are two methods in the helper class GetBDCData and FindSpecific.

 

GetBDCData method takes an entity name and param array of filter values. Key thing to keep in mind is, the number of filters defined on entity in BDC application definition file needs to match the param values count. This method will execute the Finder Method Instance on the entity and return a DataTable with all the records retrieved from LOB system.

 

FindSpecific method takes an identifier value and an entity name. Method will execute the specific finder method on the entity and return a DataTable containing the specific record retrieved from LOB system.

 

Download the BDC Helper Class Here

Hiding Search Scopes Dropdown in Master Page

When I was looking to implement this for one of the SharePoint sites I worked on, I never was able to find a step by step instructions. Here is exact steps to hide scopes drop down in site master page

Under your Features folder look for "OSearchBasicFeature" folder and copy and rename this to say for ex "SearchBasicFeatureWithOutContextualScope" 

Edit the feature.xml file and replace the  id and title, you can generate a new id by using the Generate GUID tool in Visual Studio. Here is what my customized feature file looks like

<?xml version="1.0" encoding="utf-8" ?>

<!-- Copyright (c) Microsoft Corporation. All rights reserved. -->

<Feature  Id="601D5F49-A45E-4c58-B14B-829AB593C4BC"

          Title="SearchBox with no contextual scope"

          Description="$Resources:BasicSearch_Feature_Description;"

          DefaultResourceFile="spscore"

          Version="12.0.0.0"

          Scope="WebApplication"

          ReceiverAssembly="Microsoft.Office.Server.Search, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"

          ReceiverClass="Microsoft.Office.Server.Search.Administration.BasicSearchFeatureReceiver"

          xmlns="http://schemas.microsoft.com/sharepoint/">

 

    <ElementManifests>

        <ElementManifest Location="searcharea.xml"/>

    </ElementManifests>

</Feature>

Next up open the SearchArea.xml file in Visual Studio and change the dropdownmode property to "HideDD_useDefaultScope", Here is what my customized searcharea.xml looks like

<?xml version="1.0" encoding="utf-8" ?>

<Elements xmlns="http://schemas.microsoft.com/sharepoint/">

    <Control

        Id="SmallSearchInputBoxWithOutContextualScope"

        Sequence="50"

        ControlClass="Microsoft.SharePoint.Portal.WebControls.SearchBoxEx" ControlAssembly="Microsoft.SharePoint.Portal, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c">

      <Property Name="GoImageUrl">/_layouts/images/gosearch.gif</Property>

      <Property Name="GoImageUrlRTL">/_layouts/images/twg/goRTL.gif</Property>

      <Property Name="GoImageActiveUrl">/_layouts/images/gosearch.gif</Property>

      <Property Name="GoImageActiveUrlRTL">/_layouts/images/goRTL.gif</Property>

      <Property Name="DropDownMode">HideDD_useDefaultScope</Property>

      <Property Name="SearchResultPageURL">/_layouts/osssearchresults.aspx</Property>

      <Property Name="ScopeDisplayGroupName"></Property>

      <Property Name="FrameType">None</Property>

      <Property Name="ShowAdvancedSearch">false</Property>

    </Control>   

</Elements>

 

Install the feature.

Stsadm –o installfeature –filename SearchBasicFeatureWithOutContextualScope\Feature.xml

 

Activate the feature for web application

Stsadm –o activatefeature –filename SearchBasicFeatureWithContextualScope\Feature.xml –url {your web application url}

In your master page look for content place holder PlaceHolderSearchArea and change the ControlID attribute of SharePoint Delegate control to “SmallSearchInputBoxWithOutContextualScope”

Here is an example markup from my master page

 

<asp:ContentPlaceHolder id="PlaceHolderSearchArea" runat="server">

         <!--SmallSearchInputBox -->

         <SharePoint:DelegateControl runat="server" ControlId="SmallSearchInputBoxWithOutContextualScope" />

</asp:ContentPlaceHolder>

Moving SSP Administration Site to a new web application

Here is exact steps to move SSP Administration site to a new web application

Create a new web application through central admin

Define a new "ssp/admin" manage path for the new web application created for SSP Admin site, ensure the new web application created that will host the new ssp admin site is selected and also specify "explicit inclusion" for type and "ssp/admin" for path, click "Ok"

Create a new site collection using SSP Administration site template

stsadm –o createsite –url http://{replace with your servername}:{replace with port}/ssp/admin -owneremail {owneremail} –ownerlogin {ownerlogin} –sitetemplate OSRV#0 –title “Shared Services Administration {replace with your ssp name}"

edit the ssp to point to the new ssp administration site

Stsadm –o editssp –title “{replace with your ssp name” –sspadminsite "http://{replace with your server name}:{replace with port}/ssp/admin"
Add to Technorati Favorites

 ‭(Hidden)‬ Form Web Part ‭[3]‬

 ‭(Hidden)‬ Admin Links

 Certifications

mcts_all