Tuesday, December 23

Audience Targeting to a List item

Note: Audience targeting is a feature of MOSS only, not WSS. It is a filtering technique not a security measure.

using Audience targeting concept of MOSS, we can display different contents to different people on the same page.

Steps to target list items:

1) Create User Profile

2) Create Audience Group

3) Apply targeting to list items

Steps to create User Profile:

See the post for Audience Targeting to a web part

Steps to create Audience Group:

See the post for Audience Targeting to a web part

Steps to Apply targeting to list items:

Let me explain with the help of an example

1) Create a SharePoint site with Collaboration Portal template

2) Open your SharePoint intranet site where you need to target audience

Let as take an example...... say News list items.

3) Go to the News Page by clicking on the News tab at the top

4) To ensure that Audience Targeting is enabled for that list

4.1) Click View All Site Content in the Quick Launch

4.2) Click Pages

4.3) In the Settings tab, click Document Library settings

4.4) Under general settings, click on Audience Targeting Setting

4.5) Check the Enable Audience Target check box

4.6) Click Ok

5) Add a new news item to target

5.1) Click News tab at the top

5.2) In Site Actions, click Create Page

5.3) Now Create Page is opened. Give title, description, page layout etc.

5.4) Click Create

5.5) Now you can edit the content by clicking Edit Content

5.6) Similarly add picture if you want

5.7) On the Page tab at the top, click Page Settings

5.8) There you have an option for Audience Targeting

5.9) Give the Audience Group name to which you need to target

5.10) Click Ok

6) Target Content Query web part to that particular Audience group
6.1) Click News tab at the top

6.2) In Site Actions click Edit Page

6.3) In the Edit tab of News Roll Up web part, click Modify Shared Web part

6.4) In the coming panel, expand Advanced

6.5) At tye bottom, you have an option for Audience Target

6.6) Give the name of the Audience Group there

6.7) Click Ok

7) Now login as a member of Audience then you can see that new news item oherwise not................

Audience Targeting for a web part

Note: Audience Targeting is available only in MOSS not in WSS

Steps to target a web part:

1) Create User Profile

2) Create Audience Group

3) Apply Audience Targeting to the web part

Steps to create User Profile:

1) Open Central Administration Page of SharePoint

2) Click on SharedService1 (default name. otherwise go to MOSS Administration Page)

3) Click on User Profile and Properties

4) Click Add User Profile

5) Add the details you want

6) Click Save and Close

Steps to create Audience Group:

1) Open MOSS Administration Page

2) Click Audience

3) Give the details like name, description etc.

4) Add rules for that Audience group

5) Click OK

6) Click Compile Audience

Steps to apply Audience to a web part:

1) Open your SharePoint site where you want to target web part

2) Click on the arrow at the right side of the web part

3) Click Modify Shared Web part

4) Now a panel will be opened. Expand Advanced tab (last one)

5) At the bottom, you can see Target Audience

6) Give the name of Audience group you have created

7) Click Apply

8) Click Ok

9) Exit Edit Mode

Now login as a member of audience group then as a non-member ......... U can see the magic :)

Thursday, December 18

I cannot find the Content Query Web Part

Check in http://yoursharepointsite/_layouts/newdwp.aspx page. There you can see all the webparts available to that page (Content base query webparrt). if it is there, you can directly populate it.

Ensure that Office SharePoint Server Publishing Infrastructure is activated(If and only if you installed MOSS ).

If you don't have that, do the following steps.

1) Open Central Administration Page

2) Go to Operations

3) Under Upgrade and Migration, click Enable Enterprise Features

4) Check Enterprise

5) Enter Product key

Also do this:

1) Go to Operations

2) Enable Features on existing sites, and check the box "Enable all sites in this installation to use the following set of features: Office SharePoint Server Enterprise Features".

3) Click Ok

Then you would have content query web part as a default one :)

Tuesday, December 16

Hide/Remove List Title column

(1) Go to Your list settings on which you want to hide/remove title column.

(2) Go to advanced settings of that list.

(3) Click on yes at very first option. Allow management of content types.

(4) Once you do this, one more setting panel becomes visible in advanced settings options. check out the figure below.

(5) Now click on that Item content Type.

(6) As you can see here you will find all columns are listed along with Title column.

(7) Click on that Title column.

(8) Select the last radio button which is Hidden.

(9) save all settings and then go back to list and click on new Item and see... now Title column is no more there....

Custom User Group in SharePoint

Steps:

1) Go to C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES

2) Create a new folder named ‘CustomGroup

3) Copy Feature.xml from any other folder in C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES

4) Write following code in Feature.xml file
style="font-weight:bold;">
Title="CustomGroup"
Description="This Feature Creates a Custom Group"
Version="12.0.0.0"
Hidden="FALSE"
Scope="Site"
DefaultResourceFile="core"
ReceiverAssembly="CustomGroupFeature, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=859e49442b7d12e1"
ReceiverClass="CustomGroupFeature.FeatureReceiver"
xmlns="http://schemas.microsoft.com/sharepoint/">


Notice the ResourceAssembly and ReceiverClass attributes. These serve as references to the assembly that will handle the FeatureActivated, FeatureDeactivating, FeatureInstalled and FeatureUninstalling events.

5) create the SPFeatureReceiver class referenced above

a) Open Visual Studio
b) New project  Class library
c) Name it as CustomGroupFeature
d) Add reference Microsoft.SharePoint
e) Copy the code given below:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint;

namespace CustomGroupFeature
{
class FeatureReceiver : SPFeatureReceiver
{
public override void FeatureActivated(SPFeatureReceiverProperties properties)
{
//get a reference to the site collection where the feature is activated
using (SPSite site = properties.Feature.Parent as SPSite)
{
//get a reference to the root site / web of the site collection
using (SPWeb web = site.RootWeb)
{
//get a reference to a Site Owner
//(there should always be at least 1; position 0 of the
//Administrators UserCollection)
//we'll make this user the owner of the custom group
SPMember siteOwner = web.SiteAdministrators[0];

//prepare the group name
string grpName = "Custom Group";

//check if group exists
bool grpExists = false;

//-----------------------------------------------------
//THIS CODE SHOULD BE MOVED TO ITS OWN HELPER FUNCTION
//OR UTILITIES CLASS. IN FACT MOST OF THIS CODE NEEDS
//TO BE REFACTORED
foreach (SPGroup group in web.SiteGroups)
if (group.Name.ToLower() == grpName.ToLower())
grpExists = true;
//------------------------------------------------------

//add the custom group to the site
//if it doesnt allready exist
if (!grpExists)
{
web.SiteGroups.Add(grpName, siteOwner, null,
"Custom Group that I created because I can!");
web.Update();

//get a reference to the group we just created
SPGroup customGroup = web.SiteGroups[grpName];

//add the group to the quicklaunch
web.Properties["vti_associategroups"] =
web.Properties["vti_associategroups"] + ";"
+ customGroup.ID.ToString();
web.Properties.Update();
}
}
}
}
public override void FeatureDeactivating(SPFeatureReceiverProperties properties)
{
//throw new NotImplementedException();
}
public override void FeatureInstalled(SPFeatureReceiverProperties properties)
{
//throw new NotImplementedException();
}
public override void FeatureUninstalling(SPFeatureReceiverProperties properties)
{
//throw new NotImplementedException();
}

//.....FeatureDeactivating, FeatureInstalled, and FeatureUninstalling methods
}
}

f) Create strong name
g) Build it

6) Add the dll to Assembly

7) Get the publickeytocken

8) Update in Feature.xml

9) Open command prompt

10) Go to C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN

11) Install the feature using:

stsadm.exe –o installfeature –filename CustomGroup \feature.xml –force

12) Open SharePoint site

13) Go to Site settingsSite Collection features

14) Now CustomUserGroup is available.

15) Activate this feature.

16) Now if the SharePoint site is opened, then CustomUsergroup is available.

Reference:

Display a Document or Spreadsheet

When you’ve uploaded your Microsoft© Office Word 2007 document, Microsoft© Office Excel© 2007 spreadsheet, or Web page, use the Page Viewer Web Part to display it. This Web Part can also be used to view a Web site.

1) Open the document or spreadsheet and save it as a Web page.

2) On your site, click Documents, and then click the folder in your Document Library where you will store the Web page you just created.

3) Click Upload and then click Upload Document. Click Browse, and find your document. Click your document, click Open, and then click OK.

4) Copy the address of the file you uploaded by right-clicking the file name, and then clicking Copy Shortcut. You will need this address in step 9.

5) Go to the Home page, click Site Actions, and then click Edit Page.

6) At the top of the zone in which you want the Page Viewer Web Part, click Add a Web Part. In the Add Web Parts to [zone] dialog box, scroll to the Miscellaneous section, select the Page Viewer Web Part check box, and then click Add.

7) In the Page Viewer Web Part, click open the tool pane.

8) In the Page Viewer area on the right, click Web Page. Paste the address of the document or spreadsheet, and then click OK. The document or spreadsheet is displayed within the Page Viewer Web Part.

9) When you have finished, click Exit Edit Mode to return to normal view.

Tip To move a Web Part to a different location on the page, drag the Web Part title to that location.

Add Customized Content

Use the Content Editor Web Part to display text content on your site. The Content Editor also enables you to add images, links, or tables.

1) Go to the Home page, click Site Actions, and then click Edit Page.

2) At the top of the zone in which you want to display text, click Add a Web Part. In the Add Web Parts to [zone] dialog box, scroll to the Miscellaneous section, select the Content Editor Web Part check box, and then click Add.

3) In the Content Editor Web Part, click open the tool pane. In the tool pane, click Rich Text Editor.

4) Compose a message and apply text formatting, or insert a picture or table. When you have finished, click OK.

5) In the tool pane, click OK. The text message is displayed within the Content Editor Web Part.

6) When you have finished, click Exit Edit Mode to return to normal view.

Apply a Web Part View

Use Views to modify the way the information contained in Web Parts is displayed to site users. For example, you can add or delete columns from a view or change the style.

1) On the Announcements Web Part, click the arrow to the right of the Web Part title, and then click Modify Shared Web Part.

2) In the Selected View list, click the view you want, and then click OK.

Edit the Current Web Part View

1) On the Announcements Web Part, click the arrow to the right of the Web Part title, and then click Modify Shared Web Part.

2) Click Edit the current view.

3) On the Edit View: Announcements page, in the Columns section, select the columns you want to display. Click the position from the left in which you want the column to appear.

4) In the Style section, select the style you want to display, and then click OK.

Edit the Current Web Part View

1) On the Announcements Web Part, click the arrow to the right of the Web Part title, and then click Modify Shared Web Part.

2) Click Edit the current view.

3) On the Edit View: Announcements page, in the Columns section, select the columns you want to display. Click the position from the left in which you want the column to appear.

4) In the Style section, select the style you want to display, and then click OK.

Delete a Web Part Title

A Web Part title is not required; in some cases, it may be beneficial to have no title at all.

1) Click the arrow to the right of the Web Part title, and then click Modify Shared Web Part.

2) In the tool pane, click Appearance.

3) In the Chrome Type menu, click None, and then click OK.

Modify a Web Part Title

You can modify a Web Part title and size, as well as the view (changing the displayed style, for example).

1) Click the arrow to the right of the Web Part title, and then click Modify Shared Web Part.

2) In the tool pane, click Appearance.

3) In the Title box, enter the new title you want displayed on the Web Part, and then click OK.

Modify a Web Part Size

1) Click the arrow to the right of the Web Part title, and then click Modify Shared Web Part.

2) In the tool pane, click Appearance.

3) In the Height section, choose Yes, and then enter the height you want. To change the unit of measure, click the unit you prefer from the list.

4) In the Width section, choose Yes, and then enter the width you want. To change the unit of measure, click the unit you prefer from the list.

To set the Web Part to this new size, click OK.

Move a Web Part

Click Site Actions, and then click Edit Page.
Drag the Web Part heading to the desired zone location
When you have finished, click Exit Edit Mode to return to normal view.

Delete a Web Part

When you delete a Web Part, the Web Part is permanently removed from the page.

1) Click Site Actions, and then click Edit Page.

2) In the edit menu of the Web Part you want to delete, click Delete, and then click OK.

3) When you have finished, click Exit Edit Mode to return to normal view.

Restore a Closed Web Part

1) To restore a closed Web Part to the page, click Site Actions, and then click Edit Page.

2) In any zone, click Add a Web Part. In the Add Web Parts to [zone] dialog box, click Advanced Web Part gallery and options. The Web Part you closed appears in the Closed Web Parts collection.

3) Drag the Web Part title from the list to the desired zone location.

4) When you have finished, click Exit Edit Mode to return to normal view.

Close a Web Part

When you close a Web Part, the Web Part is removed from the page. You can restore closed Web Parts later, as needed.

1) Click Site Actions, and then click Edit Page.
2) Click the in the title bar of the Web Part you want to close. The Web Part is removed from the page.
3) When you have finished, click Exit Edit Mode to return to normal view.

Add web part in SharePoint site

Steps:

1) Click Site Actions, and then click Edit Page.

2) At the top of the zone in which you want to add the Web Part, click Add a Web Part. In the Add Web Parts to [zone] dialog box, select the check box of the Web Part you want to add—this example uses the Image Web Part—and then click Add. The Image Web Part is displayed in the zone.

Tip Here’s another way to view the Web Parts list:

1) In the Add Web Parts to [zone] dialog box, click Advanced Web Part Gallery and options. In the tool pane, click the Web Part collection called [your team site name] Gallery. The Web Parts list is displayed alphabetically.

2) In the edit menu of the Image Web Part, click Modify Shared Web Part.

3) In the tool pane, under Image Link, enter the image URL or path, and then click OK.

4) When you have finished, click Exit Edit Mode to return to the default view.

Missing Office Sharepoint Service Publishing Infrastucture

It is available only in MOSS not in WSS.

In MOSS, if that option is not there then check in farm features whether it is activated at that level or not.You can get farm feature in SharePoint central administration. If it is not activated, activate it.

Applying custom master page to sharepoint sites

Applying master page:

1) Right click on test.master in sharepoint designer
2) Choose set as default master page
3) Save
4) Refresh your sharepoint site.
5) Now you can see that your sharepoint site is using test.master

This way we can apply the master page to all the pages. But if for using test.master for my entire pages, this is not a good solution. For that we have another method i.e. apply master page to one site and make that site as a template and use this template while creating new sites.

Creating template:

1) Do the 5 step procedure as mentioned above.
2) Open the sharepoint site
3) Go to site actions
4) Choose site settings.
5) Under look and feel, choose save site as template

Applying template:

1) Go to site actions.
2) Choose create
3) Choose sites and workspaces under web pages
4) Give the title and url of the newly created site.
5) Under select template, choose custom
6) There you can see the template which we have created. Choose that
7) Then create.

If you have MOSS, you can directly apply master page from sharepoint site.

1) Create a site
2) Go to site settings
3) Under look and feel, choose master page
4) Then select any master page you want.


Refer this:

http://www.cleverworkarounds.com/2007/10/08/sharepoint-branding-how-css-works-with-master-pages-part-1/