Showing posts with label SharePoint 2010. Show all posts
Showing posts with label SharePoint 2010. Show all posts
Tuesday, September 6, 2011

SharePoint DateTime Control Date Format

If you are working with DateTime Control in SharePoint, you might have a requirement to show date format (For example DD/MM/YYYY) based on the user regional setting instead of US date format (MM/DD/YYYY)

 

You can specify the regional settings locale id to DateTime local id on Page Load

 

int localId = Convert.ToInt32(SPContext.Current.RegionalSettings.LocaleId); 
dtpcStartDate.LocaleId = localId;


If you want to change the default date format, no matter what the user regional setting is, you can do it my writing the custom control by deriving from the Microsoft.SharePoint.WebControls.DateTimeControl.



 

public class CustomDatePicker : Microsoft.SharePoint.WebControls.DateTimeControl
{
protected override void OnPreRender(EventArgs e)
{
base.OnPreRender(e);
TextBox tb= (TextBox)this.Controls[0];
DateTime dt = DateTime.Parse(tb.Text);
tb.Text = dt.ToString("dd/MM/yyyy");

}

}
}


Note: For above code, I used the Autopostback = true to trigger OnPreRender event until i figure it out how to trigger onDateChangeed event client side.

Thursday, August 25, 2011

How to show dates which has TBD at the end of the SharePoint List?

I am working on the two custom web parts, one of them is filter web part and another one is a results web part which shows data filtered from the SharePoint list based on the user selection. In the filter web part, we have a date range where they can specify certain range or just leave it empty so that we just return records which are greater than or equal to current date. Since dates are not mandatory in my SharePoint list (user don’t have a date and it is TBD – to be decided), it either shows empty dates at the top if i order by dates in ascending order without any filter criteria or it won’t show empty dates if i apply filter criteria.

 

But my requirement is,

  • we should show empty dates (TBD)
  • TBD should be at the end of the result set and not in the beginning of the result set.

To implement this, we created a calculated field and use the following formula

=IF(ISBLANK(DateColumn),DATE(2099,1,1),DateColumn)

 

Where

DateColumn – is a column we used to store the user selected date in the List.

 

Above formula we used max date (01/01/2099), so that we can easily use “Greater than or equal to” to compare with other dates and also sort dates in ascending order so that max dates will so at the end.

 

In the results web part, we are using XSLT to show the data and in that we are checking dateColumn empty or not, if empty show TBD or else show actual date.

 

Hope this helps some one and have a happy programming.

Thursday, August 11, 2011

Connected Web Part Approaches

I found a very nice article about Connected web parts.

Thursday, April 14, 2011

SharePoint 2010 Certification Information

URLS:

http://www.microsoft.com/learning/en/us/certification/cert-sharepoint-server.aspx#tab2

 

Videos

http://channel9.msdn.com/learn/courses/SharePoint2010Developer

Tuesday, February 22, 2011

Navigate to Web Part Maintenance Page in SharePoint

As most of you know that there are two options to remove web parts from a SharePoint  page.

  • Close – preserves the web part’s configurations and customizations in Closed Web Parts gallery.
  • Delete – deletes permanently.

If you want to see list of all closed web parts on the page, you have to go to Web part maintenance page. However, there is no easy way to get to this page.

 

A quick way to navigate to Web Part maintenance page in both SharePoint 2007 and SharePoint 2010

 

Option 1:

Copy the following code in browser and make changes accordingly,

http://[SERVERNAME]/_layouts/spcontnt.aspx?pageview=shared&url=[Your Web Part Page URL] (For Example: /FirmCalendar/pages/default.aspx)

 

Option 2: (Much easier)

Just append the querystring “?Contents=1” to any page that contains Web parts as shown below,

http://[SERVERNAME]/default.aspx?contents=1

 

Note: In SharePoint Server 2010, a closed Web part no longer consumes the system resources as open Web parts do.

Thursday, February 10, 2011

Error occurred in deployment step 'Add Solution': Exception from HRESULT: 0x81070215

Here I got another error which won’t tell about what the error is. so, i went to SharePoint root folder (14 hive) and checked the log file. Log file contains the following error message

 

Failed to open the file 'C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\Template\Features\WebGTSTemplates\GTSProjectTemplate\onet.xml'.   

 

I Checked the ONET.xml file properties and i found that i forgot to change the Deployment Type to Element File. Once i changed, now i am able to deploy my feature successfully.

image

Hope this helps some one’s life easier. If so, leave some comments.

Thursday, February 3, 2011

Fix Disabled Page Scrolling on Navigation Settings

I don’t know how many of you having issues with Master page branding, i got lot of them and one of them was Navigation (AreaNavigationSettings.aspx) page. When the page renders/load in the browser, it disables the scrollbar even though it has content more than the viewable area and other pages are just fine.

After struggling long time to find out the cause, i couldn’t find any. So, my next option is to search in Google and see any one has similar issue. Likely i found the article from SharePoint Blues which addressing about this issue.

They mentioned about the following workaround which won’t fix the disabled scroll bars instead it hides the #s4-workspace scrollbar (Which is OOB) and shows the browser scrollbar.

$(document).ready(function() {
    $('form[action="AreaNavigationSettings.aspx"]')
        .closest('body')
        .css('overflow', 'visible')
        .find('#s4-workspace')
        .css('overflow', 'hidden');
});

Thursday, January 20, 2011

SharePoint 2010 Branding issue with wide content

I tried to branding my master page and everything works great if the page content is not big enough.

image

But when the page has wide horizontal data, I am having weird issue as show below. Somehow #s4-bodyContainer width is not set to 100%( tried both Min-width and width). Same behavior with default v4.master too.

clip_image004

I found the following hack from the internet to fix the issue.

BODY #s4-bodyContainer

        {

            display:-moz-inline-stack;

            display:inline-block;

            zoom:1;

            *display:inline;

            min-width:100%;

            *min-width:100%;

        }

This one works very well in IE8 but not in IE7. In IE7, second div pushes down.

clip_image006

I am trying to find any workaround for this issue and if i found any i will update this post.

 

Update:

02/09/2011 3:29 PM

I tired the Randy Drisgill master page, Real World Branding with SharePoint 2010 and it shows multiple scroll bars if have more data. Check the following screenshots. I feel, this is not user friendly as user has to vertically scroll down and then select horizontal scroll bar to see the data.

 

clip_image002[6]

clip_image002[4]

Monday, January 10, 2011

Error occurred in deployment step 'Add Solution': Exception from HRESULT: 0x8107026E

I got the following error when i deploying my custom web template in SharePoint 2010 environment.

 

After hours of troubleshooting, i figure it out that WebTemplate Name in the elements.xml has to match with the web template project name. See the highlighted section in the following screenshot. I hope this post will help someone and if so don’t forgot to leave a comment.

 

image

image

Friday, January 7, 2011

How to change default search box size?

By default Microsoft uses the following styles for the input box.

image

 

If you want to modify the width of the input box, you have to do either one of the following option.

Using Custom Master Page: I preferred this option since almost everyone uses there own master page to specify their corporate branding and we can easily override the width by defining custom styles in master page. Add the following code at the end of the Header section

<style type="text/css">
        /* Change the Search box size */
        .s4-search input.ms-sbplain
        {
            width: 500px !important;
        }
    </style>

Using Feature: Choose this option if you are using out of the box master page and desperately want to change the size of search box. Since search box is a delegate control we can easily customize. so i am not going into the details . You will find lot of articles when you search online on this topic and i found helpful as a starting point.

Tuesday, November 30, 2010

How to change Page Layout of existing page in SharePoint?

Recently a task was assigned to me to make sure that dev site should look like production one. First thing i noticed when i comparing two sites is both pages using different page layouts. so the question is how do you change the page layout which associated with your current page?

It is really simple once you know where to look.

  1. Go to the Page which you want to change. In my case i need to change my home page. so i browse http://mysite/home.aspx
  2. Click Site Actions and then select Edit Page option.
  3. On the toolbar, Click on Page and then select Page Settings
    image
  4. Now you can pick your page layout
  5. Click OK once you done with your changes

 

Thursday, August 19, 2010

SharePoint List Template Id’s

Following table shows the default list template and its Id’s.

 

100    Generic list
101    Document library
102    Survey
103    Links list
104    Announcements list
105    Contacts list
106    Events list
107    Tasks list
108    Discussion board
109    Picture library
110    Data sources
111    Site template gallery
112    User Information list
113    Web Part gallery
114    List template gallery
115    XML Form library
116    Master pages gallery
117    No-Code Workflows
118    Custom Workflow Process
119    Wiki Page library
120    Custom grid for a list
130    Data Connection library
140    Workflow History
150    Gantt Tasks list
200    Meeting Series list
201    Meeting Agenda list
202    Meeting Attendees list
204    Meeting Decisions list
207    Meeting Objectives list
210    Meeting text box
211    Meeting Things To Bring list
212    Meeting Workspace Pages list
300    Portal Sites list
301    Blog Posts list
302    Blog Comments list
303    Blog Categories list
1100   Issue tracking
1200   Administrator tasks list
2002   Personal document library
2003   Private document library

How to find the template name of SharePoint site?

When you look into any SharePoint site which was created by someone, first question you get is, Which template they used to create the site? It is very difficult to tell by looking at the site.

I used following approaches to find template names/ids

Approach 1: Save the site as a template

  1. Go to Site template Gallery and download the save the template to your desktop
  2. Rename the template extension from .stp to .cab.
  3. Extract .cab file contents. (I normally use WINRAR)
  4. open the manifest.xml file.
  5. Search for TemplateID and Configuration.

 

ID 0 = Global, Configuration 0 = Global Template
ID 1 = STS or SharePoint Team Site, Config  0 = Team Site
ID 1, Config 1 = Blank Site
ID 1, Config 2 = Document Workspace
ID 2 = MPS, or Meeting Place Sites, Config 0 = Basic Meeting Workspace
ID 2, Config 1 = Blank Meeting Workspace
ID 2, Config 2 = Decision Meeting Workspace
ID 2, Config 3 = Social Meeting Workspace
ID 2, Config 4 = Multipage Meeting Workspace
ID 3 = Centraladmin, config 0 - Central Admin Site
ID 4 = WIKI, Config 0 = Wiki site
ID 5, Config 0 = Blog

Any ID over 10000 is custom.

If ID is 75800 range, it might be additional Microsoft applications and templates. You can Check here.

Approach 2: Using custom ASPX page

http://blog.rafelo.com/2008/05/determining-site-template-used-on.html

Thursday, August 12, 2010

Redirect a SharePoint Site/Page to another Site/Page using Content Editor Web Part

Redirecting the user from one site/page to another site/page is most common scenario.

You might have several reasons for this like Site Move from one location to another or Point Staging to Production etc..,

 

For whatever reason, you can achieve this functionality easily using Content Editor WebPart.

 

Copy and paste the following code into your Custom Editor WebPart

 

<script language=”JavaScript”>

alert(“The site has been moved to a new location and will automatically redirect to the location.  Please update your bookmarks accordingly."”);

</script>

<meta http-equiv=”refresh” content=”0;url=http://[YOUR NEW LOCATION]”>

 

Once you save these changes, you are not able to modify any thing on this page since it is redirect to new location.

If in case you want to remove this webpart, the workaround is, you have to go through webpart maintenance page.

 

Copy the following code in Browser Address and make changes accordingly

http://[SERVERNAME]/_layouts/spcontnt.aspx?pageview=shared&url=[Your WebPart Page URL] (For Example: /FirmCalendar/pages/default.aspx)

image

Select the checkbox which you want to close, and click close button

image

 

 

To enable the closed WebParts follow these steps

1. Go To Site Actions –> Edit Page

2. Click on any Add WebParts

image

3. Click on “Advanced WebPart Gallery and Options

image

4. Click on Closed Web Parts link

image

5. Drag and drop the Content Editor WebPart Where ever you want.

 

Hope this helps some one.

Saturday, July 31, 2010

No more SSPs in SharePoint 2010

Yes there are no more Shared Service Providers (SSPs) in SharePoint 2010. This is One of the most interesting and powerful thing in SharePoint 2010. For users who are not familiar with SSPs in SharePoint 2007, you can read my previous post here.

What’s wrong with SSPs?

SSPs were vary handy in SharePoint 2007. They allowed us to share different services like profiles, audiences, search, Excel Services and BDC with different web applications. The problem is if we want to use same search service across multiple web applications but we want to have a totally different profile or BDC configuration. To achieve this functionality, the only option we have is to create a new SSP and duplicate the search service configuration/settings. In feature if we want to make any changes to search service, we have to do it in two places and It’s a hassle.

Some of the major problems with SSPs,

  • SSPs are not built on Core services (WSS) and it built on SharePoint Server.
  • SSPs are non extensible other than Microsoft SharePoint Team.
  • SSPs are tied to a single farm. Technically Shared-farm SSPs are possible, but it tricky.

image

What’s the new approach?

In SharePoint 2010 Shared Service Provides(SSPs) are replaced by Service Applications. So what ever services existed in SSPs are still exist but have been unboxed and don’t have dependencies to each other. In the new version, there are over 20 service applications built using the service application framework. All of these service applications can run independently and each service has its own database (that’s why you see many databases in SQL Server compare to SharePoint 2007). If we want, we can also built our own service application (its is a very advance topic you can find a nice video here), it’s that much flexible.

Since each service run independently,the new service application framework removes the restriction, which says, “a web application could only be associated with a single SSP”. Now web applications can consume services on a individual basis and can use any combination of the available service applications.

 

image

If one of the service has high demand, we can easily scaled out across farms.

image

 

 

Summary

  • Web application can be configured to only use a subset of deployed services.
  • You can deploy multiple instances of the same service in a farm by giving the new service instances unique names.
  • You can also share services across multiple web application.
Tuesday, July 13, 2010

SharePoint 2010 Features and Enhancements

Following is the high-level list of SharePoint 2010 features and enhancements. For detailed information you can check it here.
New in SharePoint 2010

  • Language Integrated Query (LINQ)
  • AJAX Support
  • Ribbon navigation
  • List Enhancements
    • New Scale Limits
    • XSLT Views for better customizations
    • Cascade deletes/Updates
    • Formula Validation for Column like Excel
    • External Data List Type - allows to connect external data such as databases or web services.
  • Business Connectivity Services (BCS) - New name for BDC and drastically enhanced.
  • Silverlight integration
  • Client side object Model
  • Sandbox Solutions - deploy in a secure environment.
  • Added More Services - Word,Visio, Performance Point and Access Services in addition to Excel and InfoPath Form Services.
  • New enhancements to InfoPath Form Services
    • Replace default list forms to InfoPath form
    • New mobile form capabilities
  • Well Integrated with Visual Studio 2010
    • Browse SharePoint environment from server explorer to see lists, libraries, Content types, etc.,.
    • Web Parts Visual elements
    • improved Web Solution Package (WSP)
    • Development on Windows 7
  • Developer Dashboard
  • Communities
    • Enhanced Blogging and wikis
    • Tagging and Rating
    • Activity Feeds - Stay informed and track colleagues updates
    • Social Bookmarking - can be internal or external web sites
    • Enhanced My Sites
    • Enhanced User Profiles
    • Organization Browser
  • Search
    • Extensible Search web parts
    • preview content with integrated FAST technologies
    • Phonetics people search
    • Outlook Address book style lookup
    • FAST Search - need separate license
  • Content Management
    • Document Management
      • Metadata views instead of hierarchical folder based navigation
      • Location based metadata
      • Document Routing to specific location
      • unique document IDs instead of URL based location
      • Taxonomy services
      • Document Sets - Manage collection of different content (doc,ppt,xls) into a set
    • Records Management
      • Multi stage disposition
      • In place records management
      • location based file plans
      • e-discovery
    • Web Content Management
      • New Enhanced UI
      • XHTML Compliant
      • Enhanced Page libraries
    • Digital Asset Management
      • Support most common digital assets like Video, Audio, Images
      • Bit Rate Throttling with IIS - Just in time delivery of the content instead of deliver the entire video to the user at maximum speed.
      • Remote BLOB (Binary Large OBject) storage
      • Silverlight WebPart and Media Player
    • Workflows
      • Now Workflows are Customizable
      • Allowed Site Workflows
    • SharePoint Workspace (Previously known as Groove) - allow to work offline and sync the lists, libraries and forms
Saturday, July 10, 2010

Microsoft’s SharePoint 2010 Migration Approaches

I found the following poster’s in Microsoft site on How to migrate from SharePoint 2007 to SharePoint 2010. It is very useful to understand the migration process and everyone  who are working on SharePoint migration should see this.

 

Here is the list of links to Posters:

Upgrade Planning : Poster, TechNet article

Upgrade Approaches : Poster, TechNet Article, Comparison

Upgrade Services : Poster, TechNet Article

Test Your Upgrade Process : Poster, TechNet Article

Upgrading Parent and Child Farms: Poster, TechNet Article

Tuesday, November 10, 2009

How to uncheck the send welcome email checkbox option globally?

In SharePoint, we have an option (checkbox) to send a welcome email to newly added users and this checkbox is checked by default. In my case this option is vary annoying since in most cases we don’t send an email to newly added users but sometimes i forgot to uncheck the checkbox. So i started looking into ways to ease my life.

First thing i want to find is,  was there any global setting to flip the checkbox? but there is none. So my next option is modify/edit the aclInv.aspx page which is in Layouts folder in SharePoint hive.

  1. Navigate to SharePoint Hive\TEMPLATE\LAYUTS folder.
  2. Find the aclInv.aspx file.
  3. This step is optional but I recommend to backup this file before making any changes.
  4. open the aclInv.aspx in editor.
  5. Search for “chkSendEmail”.
  6. Change Checked property from True to False.
  7. Save the page.

Repeat the same steps in all web front end servers.

Wednesday, March 5, 2008

Understanding Web Part Life Cycle

If you are writing web parts either in ASP.NET or SharePoint, you need to understand the events and order of execution.

In this post i am trying to summarize the events and its order

 

OnInit – Configuration values set using WebBrowsable properties and those in web part task pane are loaded into the web part.
LoadViewState – The view state of the web part is populated over here.
CreateChildControls – All the controls specified are created and added to controls collection. When the page is being rendered for the first time the method generally occurs after the OnLoad() event. In case of postback, it is called before the OnLoad() event. We can make use of EnsureChildControls() - It checks to see if the CreateChildControls method has yet been called, and if it has not, calls it.
OnLoad
User Generated Event – for e.g. button click on the web part.
OnPreRender – Here we can change any of the web part properties before the control output is
drawn.
RenderContents – Html Output is generated.
SaveViewState - View state of the web part is serialized and saved.
Dispose
UnLoad.