Follow the autoConfig lab below to succeed the configuration for every user at runtime
1. Create a new Webpart Library project
2. Override the CreateChildControls
// import section
using Microsoft.SharePoint.Portal.WebControls;
// attributes
private OWAInboxPart wpInbox;
protected override void CreateChildControls()
{
// inbox webpart
wpInbox = new OWAInboxPart();
Controls.Add(configureInbox(wpInbox));
}
3. Create a new method to configure your Inbox webpart. This method will determine the mailboxname and the servername at runtime for a particular user.
private OWAInboxPart configureInbox(OWAInboxPart wpInbox)
{
//Connect to the portal and get the portal context.
TopologyManager topology = new TopologyManager();
PortalSite portal = topology.PortalSites[new Uri(http://servername)];
PortalContext context = PortalApplication.GetContext(portal);
//initialize user profile config manager object
UserProfileManager profileManager = new UserProfileManager(context);
UserProfile prof = profileManager.GetUserProfile(true);
// use the profile object to retrieve the properties you need in your company to
// retrieve the mailboxname
// example: string = workmail =proPropertyConstants.WorkEmail].ToString();
wpInbox.MailboxName = "kristofdc";
wpInbox.OWAServerAddressRoot = "http://servername/exchange";return wpInbox;
}
4. Override the RenderWebPart method
protected override void RenderWebPart(HtmlTextWriter output)
{
try
{
wpInbox.RenderControl(output);
}
catch(Exception ex)
{
output.Write(ex.ToString());
}}
5. And finally you will add a CAB-setup for your custom webpart.
6. Just compile, deploy and use !
Wednesday, February 27, 2008
Tuesday, October 30, 2007
Webpart which lists out all the subsites,for which the user has got permission
Following is the C# code which lists out the names and their links of all subsites which the user has got permissions.
protected override void Render(HtmlTextWriter writer)
{
SPSite site = SPContext.Current.Site;
SPWeb web = site.OpenWeb();
SPWebCollection sites = web.GetSubwebsForCurrentUser();
foreach (SPWeb subSite in sites)
{
writer.Write(
subSite.Url
SPEncode.HtmlEncode(subSite.Title)
}
}
inside the writer. write, use a href and line breaks (br) properly so that subsite.url will come inside the a href and 'spencode.htmlencode(subsite.title)' will come in between the opening and closing tags of a href.
protected override void Render(HtmlTextWriter writer)
{
SPSite site = SPContext.Current.Site;
SPWeb web = site.OpenWeb();
SPWebCollection sites = web.GetSubwebsForCurrentUser();
foreach (SPWeb subSite in sites)
{
writer.Write(
subSite.Url
SPEncode.HtmlEncode(subSite.Title)
}
}
inside the writer. write, use a href and line breaks (br) properly so that subsite.url will come inside the a href and 'spencode.htmlencode(subsite.title)' will come in between the opening and closing tags of a href.
Adding a custom menu item

This describes how to add a custom menu to a document library.
Adding the Web Part to a Page
In SharePoint, navigate to a page with a document library web part on it, or add one to an existing page.
On the Modify Shared Page menu, point to Add Web Parts and click on Browse.
Drag the Content Editor Web Part from the tool pane onto the page, then click Open Tool Pane link in the web part.
In the Layout section clear the Visible on Page checkbox. This means the web part is not visible to the end-user, but the script we add to the web part is still delivered to the client browser. In the page design view, you can still see the web part, but it is marked as hidden. If you wish you can also change the title of the web part in the Appearance section of the tool pane.
From the tool pane, open the Source Editor and insert the following script:
function Custom_AddDocLibMenuItems(m, ctx)
{
var strDisplayText = "Custom Menu!";
var strAction = "alert('Custom Menu!')";
var strImagePath = "";
// Add our new menu item
CAMOpt(m, strDisplayText, strAction, strImagePath);
// add a separator to the menu
CAMSep(m);
// false means that the standard menu items should also be rendered
return false;
}
script language="javascript" should precede these codes
function Custom_AddDocLibMenuItems(m, ctx)
{
var strDisplayText = "Custom Menu!";
var strAction = "alert('Custom Menu!')";
var strImagePath = "";
// Add our new menu item
CAMOpt(m, strDisplayText, strAction, strImagePath);
// add a separator to the menu
CAMSep(m);
// false means that the standard menu items should also be rendered
return false;
}
script language="javascript" should precede these codes
and closing scripts tag should proceede it.
Click Save in the Source Editor, and then click OK in the tool pane.
Now test the web part by opening a document library drop-down menu on the same page. You should see the new menu item at the top of the menu with a separator bar splitting it from the rest of the menu
Click Save in the Source Editor, and then click OK in the tool pane.
Now test the web part by opening a document library drop-down menu on the same page. You should see the new menu item at the top of the menu with a separator bar splitting it from the rest of the menu
Thursday, August 30, 2007
Sharepoint Ebooks and documents
Go to this link to see lots of sharepoint documents and ebooks.
http://www.esnips.com/web/Alex-Sharepoint/
Some ebooks with bigger sizes could not be uploaded.
Mail me to get those.
http://www.esnips.com/web/Alex-Sharepoint/
Some ebooks with bigger sizes could not be uploaded.
Mail me to get those.
Wednesday, August 8, 2007
Configure the Office 2007 System
Configuration Wizard automatically pops up, once the installation is complete.
In the eventuality that the Configuration Wizard does not launch automatically after the system is back up, click Start, All Programs, Administration Tools, SharePoint 3.0 Central Administration and select Yes to launch the Wizard.
1. Click Next in the Welcome page
2. Click Yes on the following message which alerts about restarting the services.
2. Click Yes on the following message which alerts about restarting the services.

3. On the Connect to a server farm page select No, I want to create a new server farm and click Next.
(The other option is… Yes, I want to connect to an existing server farm. Select this option if you already have an existing server farm.)
4. In the Specify Configuration Database Settings page
Database Server:
Database name:<>(The default database name)
5. In the Specify Database Access Account section on the same page:
Username:
Password:
6. Click Next
7. In the Configure SharePoint Central Administration Web Application page
Keep the auto-generated port number (Do not check the box) or change it if you need to.
8. In the Configure Security Settings section on the same page
Select NTLM (the default selection – the other option is Kerberos)
9. Click Next
10. Verify that all the settings are as they should be
11. Click Next (Steps 1 – 9 begin)
Note: In about 10 – 15 min the Configuration Successful will appear.
12. Click Finish
13. Installation completed and the Central Administration appears.
Installing MOSS 2007 on a server
Here, you will install and configure the Office 2007 System as a single server farm architecture.
1. Launch the Setup program of the Office System Server (OSS)
2. Accept the Software License Terms and enter your Product Key
3. Select Advanced-> Complete – Install all components. Can add servers to form a SharePoint farm.
4. Click Install Now
5. Check the box to Run the SharePoint Products and Technologies Configuration Wizard now
6. Click Close
7. Select Yes to boot now.
1. Launch the Setup program of the Office System Server (OSS)
2. Accept the Software License Terms and enter your Product Key
3. Select Advanced-> Complete – Install all components. Can add servers to form a SharePoint farm.
4. Click Install Now
5. Check the box to Run the SharePoint Products and Technologies Configuration Wizard now
6. Click Close
7. Select Yes to boot now.
Subscribe to:
Comments (Atom)