Tuesday, August 31, 2010

Hide Empty Web Parts with jQuery

Every once in a while I happen to be in a situation where I have created a basic Web Part page with multiple Web Parts. Some of these Web Parts displays/shows content at all time, while others only has content whenever an action is performed. (i.e. connected Web Parts, Search Web Parts etc)

One of SharePoint's (many) annoying drawbacks is the fact that "empty" Web Parts not actually appear empty, now matter how much you fiddle with the chrome-settings....

Setting the chrome to "none" doesn't help much either :-(

All in all, you end up with a lot of empty areas on the page, depending on how you organize your Web parts of course... :-)

So what can you do to overcome this "major" issue:

Well, I have been playing around a little with jQuery scripts and have accomplished to write a code snippet which actually hides all the empty Web parts, as long as the page is display in normal mode (not design/edit mode)

The package consists of a fairly simple Content Editor Web Part (.dwp file), with some lines of jQuery code, and a reference to the jQuery.js library. (located in the /_layouts/ catalogue by default)

If you're in the same situation, feel free to give it a try :-)

The Web Part can be downloaded here:
Hide Empty Web Parts (jQuery)

The jQuery Library can be downloaded here:
jQuery: The Write Less, Do More, JavaScript Library

- Download the jQuery Library (rename to jquery.js), and copy the file to the layouts catalogue within the 12-hive.
- Download the Web Part file and simply import the Web Part to any page you would like to run the script on.

Monday, August 9, 2010

SharePoint Feature Manager 2.0

SharePoint Feature Manager Version 2.0 is now released on CodePlex.

The new version adds features for managing Site Features as well as Site Collection Features through Central Administration.

New Features:
- Site Collection Features
- Support for Hidden Features
- Several ehancements in the user interface

Visit SPFeatureManager on CodePlex for more information and download.

Monday, January 11, 2010

SharePoint Print List (SPPrintList) Released!

SharePoint Print List (SPPrintList) solution is now released on CodePlex.
This tool can be used to print a view from any list or library within SharePoint.

Supports views as well as sorting and filtering :-)

Go to SPPrintList Project on CodePlex for more info and download...

Wednesday, January 6, 2010

SharePoint Feature Manager

I've just finished publishing a CodePlex project for SharePoint Feature Manager, SPFeatureManager.

If you've ever wanted to activate/deactivate a Feature on multiple sites in one operation, look no further.

Visit SPFeatureManager Project on CodePlex for more information and download.

Tuesday, November 27, 2007

Public Property Objects in .Net 2.0/Sharepoint Web Parts (Other than string, bool, int &enum)

I were working on a Custom Web Part for a customer, when I came to the point where I needed to save custom properties in a Web Part, besides the more common ones like string, bool, int and enum.

Theese properties was not to be exposed to the user in the property-pane, but merely to be saved for other purposes.

In my case I needed to save values to an ArrayList and/or a HashTable.

The trick is to define the property as follows:

private ArrayList _myProperties = new ArrayList();

[WebBrowsable(false), Personalizable(true)]

public ArrayList MyProperties
                return this._myProperties;
                this._myProperties = value;

When this is done, you can simply save values to the object from your custom EditorPart (ToolPart), and access it from the Host Web Part.

SharePoint CAML - filtering on DateTime WITH TimeValue. Finally a solution...

After searching the Internet for quite long now, I've finally managed to locate a solution to executing SPQuery in SharePoint (CAML), by filtering on the TimeValue in DateTime columns.

There have not been any (good) documentation on CAML Queries or SPQuery in the SharePoint SDK.

My temporary solution was to retrieve a larger collection based on the Date-value in DateTime, and then filter on Time-value manually. The code was quite ugly and time-consuming....

Well, as mentioned, there is now a solution to the problem:

The key is to include the following property/parameter in the DateTime tag in the CAML query: IncludeTimeValue="True"

<Value Type=”DateTime” IncludeTimeValue=”TRUE”><Today /></Value>
Creds goes to ucsharp, for posting this in his blog

Thursday, October 25, 2007

BDC Authentication Model

The following authentication modes are available when you use the Business Data Catalog to connect to a database or Web service.

Pass-Through (Database and Web Service Systems)

Pass-through authentication refers to the ability of the operating system to pass a client's authentication information to the back-end server. The Business Data Catalog supports pass-through authentication for both database and Web service connections. When you use pass-through authentication, you simply authenticate as the identity of the end user.

When the Business Data Catalog is accessed from a Web page, it runs in the Microsoft Internet Information Services (IIS) worker process, w3wp.exe. The identity of this process is the IIS application pool account impersonating the logged-on user. To avoid losing the logged-on user’s identity when the Business Data Catalog authenticates to the back-end server, you must enable Kerberos delegation between the server running IIS and the other computer. Kerberos delegation enables a receiving server to send the authentication request to the proper location.

When the Business Data Catalog is used for crawling, it runs in the filter daemon process, mssdmn.exe. To access the back-end content source, the threads in the filter daemon process impersonate as the content access account associated with that back-end content source.

A drawback to using pass-through authentication is that the operating system exposes only the user name and password. Therefore, if a company uses two-factor authentication (that is, users are required to have some specific—private—information in addition to a user name and password), you cannot use pass-through authentication.

Despite these drawbacks, simplicity of use makes pass-through authentication a good candidate for use in a testing environment. You might also use it if the destination server uses anonymous authentication or SSL connections.

RevertToSelf (Database and Web Service Systems)

If a user logs on with Windows Authentication, IIS impersonates that particular account. So while IIS runs under the Application Pool Identity, it impersonates the logged-on user, and the request runs under the user’s impersonation before it is passed forward.

RevertToSelf authentication allows you to revert this impersonation and authenticate as the underlying account that is configured for the IIS Application Pool.

WindowsCredentials (Database and Web Service Systems)

Microsoft Office SharePoint Server 2007 authenticates by using Microsoft Windows credentials from its default single sign-on (SSO) service.

RdbCredentials (Database Systems Only)

In RdbCredentials mode, Office SharePoint Server 2007 authenticates by using database credentials from its default SSO service. Office SharePoint Server 2007 adds the database credentials to the connection string and transmits the credentials to the database server.

Credentials (Web Service Systems Only)

Office SharePoint Server 2007 authenticates Web service systems by using credentials other than those from Windows Authentication from its default SSO service. These credentials are used for basic or digest authentication, depending on the configuration of the Web services server. Because basic and digest authentication do not adequately protect credentials, you should use SSL or IPSec or both to secure communication between the Web services server and the server running the Business Data Catalog.

Business Card