Download the free e-book “First Look: Microsoft Office 2010” from here
My World, My Views
Download the free e-book “First Look: Microsoft Office 2010” from here
Posted by Sanjay Sansanwal at 9:11 am 2 comments
Labels: General
While upgrading from MOSS 2007 to SharePoint 2010, you might get the following error-
The current farm uses database from the follwoing SQL server(s) whose versions are not supported. |
To fix this you need to install cumulative updates for SQL Server 2008 SP1
http://support.microsoft.com/kb/970315
Posted by Sanjay Sansanwal at 11:47 am 1 comments
Labels: MOSS
One of easiest way to move Web Application virtual path is to delete the Web application(only IIS site) from Central Administration and recreate them again using new path. But you cannot move Central Admin site using this approach.
After goggling for sometime, I found this nice article which describes the steps to move SharePoint sites including Central Admin
The link is http://www.mattjimison.com/blog/2009/02/26/how-to-change-the-iis-path-for-a-sharepoint-web-application/\
Posted by Sanjay Sansanwal at 10:17 am 0 comments
Labels: MOSS
SharePoint 2010 provide functionality to install SharePoint 2010 on Windows7. Follow these steps to install on Windows7(64-bit):
1. Install SQL Express 2008 from "http://www.microsoft.com/express/sql/download/”
2. Download SharePoint 2010 Beta from http://technet.microsoft.com/en-us/evalcenter/ee388573.aspx. Copy the exe to the folder C:\SharePointFiles
3. Open Command prompt and run
c:\SharePointFiles\ en_sharepoint_server_2010_beta_x64_x16-19249.exe /extract:c:\SharePointFiles
4. Open the file using notepad “c:\SharePointFiles\files\Setup\config.xml”
5. Add <Setting Id="AllowWindowsClientInstall" Value="True"/> to the Configuration section
6. Install the Filter Pack from C:\SharePointFiles\PrerequisiteInstallerFiles\FilterPack\ FilterPack.msi
7. Install the following softwares:
8. Run following command to Install Windows Features(IIS and other related)
start /w pkgmgr /iu:IIS-WebServerRole;IIS-WebServer;IIS-CommonHttpFeatures; IIS-StaticContent;IIS-DefaultDocument;IIS-DirectoryBrowsing;IIS-HttpErrors; IIS-ApplicationDevelopment;IIS-ASPNET;IIS-NetFxExtensibility; IIS-ISAPIExtensions;IIS-ISAPIFilter;IIS-HealthAndDiagnostics; IIS-HttpLogging;IIS-LoggingLibraries;IIS-RequestMonitor;IIS-HttpTracing;IIS-CustomLogging; IIS-Security;IIS-BasicAuthentication;IIS-WindowsAuthentication;IIS-DigestAuthentication; IIS-RequestFiltering;IIS-Performance;IIS-HttpCompressionStatic;IIS-HttpCompressionDynamic; IIS-WebServerManagementTools;IIS-ManagementConsole;IIS-IIS6ManagementCompatibility; IIS-Metabase;IIS-WMICompatibility;WAS-WindowsActivationService;WAS-ProcessModel; WAS-NetFxEnvironment;WAS-ConfigurationAPI;WCF-HTTP-Activation; WCF-NonHTTP-Activation
|
9. Run “c:\SharePointFiles\Setup.exe” to install SharePoint
10. On “Choose the installation you want page”, click Standalone
11. Choose default settings and complete the installation
12. Now, run RegEdit and browse to “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\14.0\WSS”
13. Change “ServerRole” value from SINGLESERVER to WFE
14. Start the “the SharePoint Products and Technologies Configuration Wizard” and follow the steps to install SharePoint 2010
Posted by Sanjay Sansanwal at 12:08 pm 2 comments
Labels: MOSS
SharePoint 2010 comes with a great feature – Sandboxed Solution. This is type of solution which could be deployed to a site by a site administrator. A site administrator don’t need to be a farm administrator to deploy the solution. The solution have full access to the site where it is deployed but limited to other sites and resources for security reason.
This would be ideal for SharePoint Online services where you could create multiple sites and give user permission to manage and upload custom code to their site without needing assistance from farm administrator
To create a sandboxed solutions:
Now, you could add your artifacts(web parts, activate features) specific to your site
Posted by Sanjay Sansanwal at 3:43 pm 0 comments
Labels: MOSS
If MOSS 2007, the code to read the list object use to be
SPWeb web;
SPList list = null;
try
{
list = web.Lists[“Pages”] }
catch(Exception ex)
{
// List not found
}
The reason to have a try-catch was because SharePoint would throw an exception if the list does not exist
Glad to see that in SharePoint 2010, this issue is fixed. The code in SharePoint 2010, would be
SPWeb web;
SPList list = web.Lists.TryGetList(“Pages”)
TryGetList returns the list with the specified title from the list collection, but returns null if its not found. No more more error handling is required
Posted by Sanjay Sansanwal at 1:23 pm 0 comments
Labels: MOSS
SharePoint 2010 comes with SpMetal tool that auto-generate entity types based on a list definition. It uses the SharePoint Lists web service to get the schema of a list.
This tool is located at c:\program files\common files\microsoft shared\web server extensions\14\bin
The syntax is
spmetal.exe /web:SITE-URL /namespace:YOUR_NAMESPACE /code:CLassName.cs
Posted by Sanjay Sansanwal at 12:16 pm 0 comments
Labels: MOSS
This is not installed in GAC and hence would not be visible in .NET assembly tab when adding a new reference to project. This is located under at “C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\ISAPI”
Posted by Sanjay Sansanwal at 12:11 pm 0 comments
Labels: MOSS
This web part have been replaced by XSLT List View Web part in SharePoint 2010. The old Data View Web part is still supported in SharePoint 2010 but not recommended to use.
Posted by Sanjay Sansanwal at 12:00 pm 1 comments
Labels: MOSS
SharePoint 2010 comes up with great tool to check the performance and process steps(same like ASP.NET trace). This would enable the following information to be displayed:
· The SQL queries they have and their timings.
· Web Part Events Offsets for testing performance against custom web parts.
· Trace information, usually only found in the ULS logs, now available on the page.
· A tree view of all controls on the page.
· Session and Cookie information
To enable it, follow these steps:
Posted by Sanjay Sansanwal at 11:51 am 0 comments
Labels: MOSS
When you update a parent content type, the following consideration need to be taken account:
Posted by Sanjay Sansanwal at 4:59 pm 0 comments
Labels: MOSS
This error occurs when you are trying to create a 64 Bit operating system VMware.
To fix this, restart your machine and enter your system BIOS. Look for Virtualization property and enable it. This is disabled by default.
Posted by Sanjay Sansanwal at 4:38 pm 2 comments
Labels: MOSS
You can't install SharePoint 2010 on Microsoft Virtual PC as it needs 64 bit Platform. As of now, Microsoft Virtual PC don’t support 64 bit operating system guest.
To overcome, you need to use VMWARE as Windows 2008 64 Bit could be installed on VMware Client.
Posted by Sanjay Sansanwal at 4:29 pm 1 comments
If you try to install Windows 7 64-bit on 32-bit Vista, the following error would occur:
The Version of this file is not compatible with the version of Windows you're running.
The issue is you can’t do a direct in-pace upgrade from 32-bit to 64-bit Windows 7. The only way to do a clean install. Follow the below steps:
Enjoy the wonderful experience of Windows 7
Posted by Sanjay Sansanwal at 4:13 pm 0 comments
Labels: General
To update a lookup field in SharePoint, you need to use SPFieldLookupValue constructor
The format is
Item[“LookupField”] = new SPFieldLookupValue(ITEM_ID, ITEM_TITLE);
Posted by Sanjay Sansanwal at 11:38 am 0 comments
Labels: MOSS
You need to perform these steps:
Get a blank page from file system or using the below function
StringBuilder sb = new StringBuilder(); |
Now, add this blank page to the Pages Library
SPList list = web.Lists["Pages"];
SPFile file= list.RootFolder.Files.Add(“blankpage.aspx”, blankPage);
Posted by Sanjay Sansanwal at 11:35 am 0 comments
Labels: MOSS
This comes in two offerings:
Standard Offering | Dedicated Offering |
Cost efficiency optimized for customers with up to 20,000 users |
The dedicated offering support custom code including SharePoint Packages
For developing on SharePoint Online Services, check this white paper which describes the customization (or extensibility) capabilities that are supported with the Standard offering of SharePoint Online-
Microsoft SharePoint Online Standard Developer Guide (http://www.microsoft.com/downloads/details.aspx?familyid=d007f35e-375c-4b11-bc40-bc9082bb224a&displaylang=en&tm)
Posted by Sanjay Sansanwal at 3:53 pm 0 comments
Labels: MOSS
Seeing the prospect and future in cloud computing, Microsoft have moved rapidly in BPOS(Business Productivity Online Suite). This Suite contains of:
The next product to add to this suite would be Dynamics CRM. Having SharePoint online using Microsoft Live services is a great initiate as this would help to target small to medium customer. These customer who wants to have a presence on web would vastly benefit from this cost effective, secure and reliable server.
For more details check http://www.microsoft.com/online/default.mspx and try 30 days trial
Follow the Microsoft Online Service team on their blog at http://blogs.technet.com/msonline/default.aspx
Posted by Sanjay Sansanwal at 3:41 pm 0 comments
Labels: MOSS
public static SPListItem WorkflowTaskItemBasedOnListItem(SPWeb web, string listName, string workflowTaskListName, int itemId)
{
SPListItem workflowItem = null;
SPList workflowTasks = web.Lists[workflowTaskListName];
SPList mainList = web.Lists[listName];
SPListItem listItem = mainList.GetItemById(Convert.ToInt32(itemId));
SPWorkflowFilter filter = new SPWorkflowFilter();
filter.InclusiveFilterStates = SPWorkflowState.Running;
// Get a list of workflow tasks associated with current Item
SPWorkflowTaskCollection workTaskColl = web.Site.WorkflowManager.GetItemTasks(listItem, filter);
foreach (SPWorkflowTask task in workTaskColl)
{
if (task != null)
{
workflowItem = workflowTasks.GetItemById(task.ID);
break;
}
}
return workflowItem;
}
This function returns a workflow item based on Parent List item Id. It reads the List Item and finds the associated workflow which are still running against this list item.
Posted by Sanjay Sansanwal at 10:38 am 9 comments
Labels: MOSS
Make sure you are not storing any object of SPUser type in Session on ViewState. I was getting this error SPUser was persist in ViewState. We changed the logic to store LoginName and everything worked fine
Posted by Sanjay Sansanwal at 10:35 am 0 comments
Labels: MOSS
Recently, I was getting this error when non-admin were trying to alter a workflow task. My code was running under elevated permission using the option first as described in my last post(using SharePoint\System) user
To fix, I need to run the code under elevated permission using second option as described in my last post(RunWithElevatedPrivileges)
string siteURL = SPContext.Current.Site.Url;
SPSecurity.RunWithElevatedPrivileges(delegate()
{
SPSite objSite = new SPSite(siteURL);
SPWeb web= objSite.OpenWeb();
web.AllowUnsafeUpdates = true;
Hashtable taskHash = new Hashtable();
SPListItem item = null;
item["Status"] = "Completed";
SPWorkflowTask.AlterTask(item, taskHash, false);
web.AllowUnsafeUpdates = false;
});
Posted by Sanjay Sansanwal at 10:29 am 1 comments
Labels: MOSS
There are 2 ways to run code under elevated permissions. The first one is using the token created from SharePoint\System(internal user) user
public static SPWeb GetElevatedWeb
{
get
{
var superUser = SPContext.Current.Web.AllUsers[@"SHAREPOINT\SYSTEM"];
var superToken = superUser.UserToken;
using (var site = new SPSite(SPContext.Current.Web.Url, superToken))
{
return site.RootWeb;
}
}
}
This function returns a SPWeb object which is created using elevated permissions
The second method is using SPSecurity.RunWithElevatedPrivileges
public static SPWeb GetSPElevatedWeb
{
get
{
SPWeb web = null;
string siteURL = SPContext.Current.Site.Url;
SPSecurity.RunWithElevatedPrivileges(delegate()
{
SPSite objSite = new SPSite(siteURL);
web = objSite.OpenWeb();
});
return web;
}
}
The SPSite object is created by reading the SPContext object before calling RunWithElevatedPrivileges as the context will change in the code block
Posted by Sanjay Sansanwal at 10:23 am 3 comments
Labels: MOSS
To create custom groups in SharePoint, use the SPWeb SiteGroups collection.
web.SiteGroups.Add(groupName, owner, member, description)
Groups created using code will not automatically appear in left navigation. For them to appear there, the groups need to be associated with web. The code to this is
web.Properties["vti_associategroups"] = web.Properties["vti_associategroups"] + “;” + web.SiteGroups[groupName].ID.ToString();
web.Properties.Update();
Posted by Sanjay Sansanwal at 4:39 pm 0 comments
Labels: MOSS
taskListItemId = id of task item
web = Web object
SPListItem taskItem = taskList.GetItemById(taskListItemId);
Guid workflowInstanceId = new Guid((string)taskItem["WorkflowInstanceID"]);
SPWorkflow workflowInstance = new SPWorkflow(web, workflowInstanceId);
SPList itemList = workflowInstance.ParentList;
SPListItem parentListItemId = itemList.GetItemById(workflowInstance.ItemId);
Posted by Sanjay Sansanwal at 4:31 pm 2 comments
Labels: MOSS
SPUser superUser = SPContext.Current.Web.AllUsers[@"SHAREPOINT\SYSTEM"];
string superToken = superUser.UserToken;
using (var site = new SPSite(SPContext.Current.Web.Url, superToken))
{
return site.RootWeb;
}
This function would return a web object running under the super user “SharePoint\System” (inbuilt) account
Posted by Sanjay Sansanwal at 4:22 pm 0 comments
Labels: MOSS
To retrieve the attachment, access the folder object of the item and then read the files
SPFolder folder = Web.Folders["Lists"].SubFolders[listName];
folder = folder.SubFolders["Attachments"].SubFolders[itemNo];
foreach (SPFile file in folder.Files)
{
}
Posted by Sanjay Sansanwal at 4:19 pm 0 comments
Labels: MOSS
Web object’s AllUsers property returns user which have accessed the site. To validate a user which has never existed on the site use
Web.EnsureUser(strUserLogin);
Posted by Sanjay Sansanwal at 4:16 pm 0 comments
Labels: MOSS
Add a quick launch link group
public static void AddQuickLaunchGroup(SPWeb web, string groupName)
{
SPNavigationNodeCollection quickLaunchNodes = web.Navigation.QuickLaunch;
SPNavigationNode groupMenu = new SPNavigationNode(groupName, "", false);
quickLaunchNodes.AddAsFirst(groupMenu);
web.Update();
}
Remove quick link group-
public static void RemoveQuickLaunchGroup(SPWeb web, string groupName)
{
SPNavigationNodeCollection quickLaunchNodes = web.Navigation.QuickLaunch;
foreach (SPNavigationNode node in quickLaunchNodes)
{
if (string.Compare(node.Title, groupName) == 0)
{
quickLaunchNodes.Delete(node);
web.Update();
break;
}
}
}
Add Quick launch link to a group-
public static void AddQuickLaunchLink(SPWeb web, string groupName, string linkName, string linkUrl)
{
SPNavigationNodeCollection quickLaunchNodes = web.Navigation.QuickLaunch;
foreach (SPNavigationNode node in quickLaunchNodes)
{
if (string.Compare(node.Title, groupName) == 0)
{
SPNavigationNode linkNode = new SPNavigationNode(linkName, linkUrl, true);
node.Children.AddAsFirst(linkNode);
web.Update();
break;
}
}
}
Remove quick launch link from a group-
public static void RemoveQuickLaunchLink(SPWeb web, string groupName, string linkName)
{
SPNavigationNodeCollection quickLaunchNodes = web.Navigation.QuickLaunch;
foreach (SPNavigationNode node in quickLaunchNodes)
{
if (string.Compare(node.Title, groupName) == 0)
{
foreach (SPNavigationNode nodeChild in quickLaunchNodes)
{
if (string.Compare(nodeChild.Title, linkName) == 0)
{
node.Children.Delete(nodeChild);
web.Update();
break;
}
}
}
}
}
Posted by Sanjay Sansanwal at 4:14 pm 1 comments
Labels: MOSS
SPView view = list.DefaultView;
view.ViewFields.Add(fieldName);
view.Update();
Posted by Sanjay Sansanwal at 2:01 pm 0 comments
/// <summary>
/// Adds the lookup field to list.
/// </summary>
/// <param name="web">The web.</param>
/// <param name="list">The list.</param>
/// <param name="fieldName">Name of the field.</param>
/// <param name="lookupListName">Name of the lookup list.</param>
/// <param name="lookupFieldName">Name of the lookup field.</param>
SPField AddLookupFieldToList(SPWeb web, SPList list, string fieldName, string lookupListName, string lookupFieldName)
{
SPList destList = web.Lists[lookupListName];
list.Fields.AddLookup(fieldName, destList.ID, required);
SPFieldLookup field = list.Fields[fieldName] as SPFieldLookup;
field.LookupField = destList.Fields[lookupFieldName].InternalName;
field.Update(true);
return field;
}
Posted by Sanjay Sansanwal at 1:57 pm 0 comments
Labels: MOSS
SPList list;
list.Fields.Add(fieldName, SPFieldType.User, required);
SPFieldUser field = list.Fields[fieldName] as SPFieldUser;
field.SelectionMode = SPFieldUserSelectionMode.PeopleOnly;
field.AllowMultipleValues = false;
field.Presence = true;
field.Update(true);
Posted by Sanjay Sansanwal at 1:55 pm 0 comments
Labels: MOSS
In User Profile, I was unable to modify any user property mapping due to missing Data Source field dropdown. There was no question of untrusted domain as I am using only one active directory and SharePoint was able to import from that. I finally managed to fix these by following these steps:
Posted by Sanjay Sansanwal at 2:58 pm 0 comments
Labels: MOSS
If you are planning to remove a web part from a page, ALWAYS click on Delete menu rather than pressing the X button. Clicking on X button would close the web part and you will receive a warning in your servers event log. The web part is not actually deleted from the page, it is removed from the Visible area of the page and placed in the Web Part Page Gallery.
You can delete a CLOSED web part by using the Web Part Maintenance page. Browse to http://www.yourserver.com/yoursite/yourpage.aspx?contents=1
You could see the web part that has been closed. Now, delete it by selecting the checkbox and pressing Delete
Posted by Sanjay Sansanwal at 3:55 pm 0 comments
Labels: MOSS
You could get the current user in SharePoint by calling the following code:
SPUser user = SPContext.Current.Web.CurrentUser;
But to access the current user inside the code running under Elevated Privileges, open new reference to SPSite.
|
The above code will switch the user context and now, you would get the user under which application pool is running
Posted by Sanjay Sansanwal at 3:06 pm 1 comments
Labels: MOSS
When you run your code with Elevated Privileges, the code runs under the identity of the hosting application pool. SharePoint\System account exists ONLY within content of SharePoint runtime(not recognised by Windows Security subsystem) and map internally to the account under which application pool is running.
If you are running application pool under DOMAIN\SSUSER account, the code is still audited as running under SharePoint\System account. So, if you get access error on SharePoint site stating that SharePoint\System account don’t have access to the resource, this is because the application pool identity account don’t have access to the resource. Don’t spend time looking for SharePoint\System account :-)
Posted by Sanjay Sansanwal at 2:58 pm 2 comments
To assign manager from one profile to another, you could not set it directly. You need to convert the Source Manager profile to a UserProfile object and then assign the account name to the destination profile manager’s property.
UserProfileManager upManager; UserProfile sourceProfile, destProfile; string managerId = sourceProfile["manager"].Value.ToString(); if (upManager.UserExists(managerId)) { UserProfile managerProfile = upManager.GetUserProfile(managerId); destProfile["manager"].Value = managerProfile["Accountname"].Value; } |
Posted by Sanjay Sansanwal at 10:44 am 0 comments
Labels: MOSS
You could change the regional setting of the site by browsing to Site Actions > Site Settings > Regional Settings
You could also change the Locale using the following code:
using (SPSite site = new SPSite("http://SITE"))
{
using (SPWeb web = site.OpenWeb())
{
SPRegionalSettings newRegionalSettings = new SPRegionalSettings(web);
// Change to Australia
newRegionalSettings.LocaleId = 3081;
web.RegionalSettings = newRegionalSettings;
web.Update();
}
}
Posted by Sanjay Sansanwal at 1:27 pm 0 comments
Labels: MOSS
You could add in-line script to a SharePoint page or Page template.
<asp:Content ID="main" runat="server" ContentPlaceHolderID="PlaceHolderMain">
<% Response.Write("Hello Sanjay Sansanwal"); %>
</asp:Content>
You would able to access this page without error provided this page is ghosted(uncustomised) as WSS complies a ghosted page into an assembly DLL for processing.
But if you customise this page or open in SharePoint, SharePoint safe mode don’t allow this and you would get error “Code blocks are not allowed in this file”.
You could force SharePoint to allow in-line scripts in customised pages by adding following to the web.config
<SharePoint>
<SafeMode ... >
<PageParserPaths>
<PageParserPath
VirtualPath="/Study/CustomPages/*"
IncludeSubFolders="true"
CompilationMode="Always"
AllowServerSideScript="true" />
</PageParserPaths>
</SafeMode>
</SharePoint>
Note: You should avoid doing this as it compromise SharePoint security. In-Line scripts are not allowed in customised pages so that unwanted user could not write malicious code to hack the system.
Posted by Sanjay Sansanwal at 3:55 pm 0 comments
Labels: MOSS
Change the elements.xml described in last blog posting to add a menu item to the menu which appears when you edit a document item
<CustomAction Id="ListMenuForMyPage"
RegistrationType="List"
RegistrationId="101"
ImageUrl="/_layouts/images/GORTL.GIF"
Location="EditControlBlock"
Sequence="105"
Title="My Page" >
<UrlAction Url="~site/_layouts/CustomPages/MyPage.aspx?ItemId={ItemId}&ListId={ListId}"
/>
</CustomAction>
This CustomAction element is different than what you have seen before because it has a RegistrationType attribute that is assigned a value of List. It also is configured with a RegstrationID attribute that is assigned a value of 101. Note that 101 is a list type identifier that applies to all document libraries. You should also notice that the Location attribute has a value of EditControlBlock, which creates the effect of adding the menu item to the ECB menu of documents within a document library.
Note the {ListId} token and the {ItemId} token within the UrlAction Url’s QueryString. MOSS dynamically replaces them with list GUID and itemId
Posted by Sanjay Sansanwal at 3:08 pm 0 comments
Labels: MOSS
Create a new feature which copy custom page(My Page) to the layout\CustomPages folder. Add the following in the elements.xml to create a custom action item.
<!-- Add Command to Site Actions Dropdown -->
<CustomAction Id="SiteActionsToolbar"
GroupId="SiteActions"
Location="Microsoft.SharePoint.StandardMenu"
Sequence="2001"
Title="My Page"
Description="Browse to my custom page"
ImageUrl="/_layouts/images/DECISION.GIF">
<UrlAction Url="~site/_layouts/CustomPages/MyPage.aspx"/>
</CustomAction>
This would add a new menu called “My Page” to the Site Actions menu.
When creating a CustomAction element, you can configure the URL attribute of the inner UrlAction element by using the ~site token, as you have just seen. You could also use ~sitecollection token in cases in which custom page should always be executed within a URL associated with the current site collection and its top-level site.
To restrict this page to only viewable to administrator, add RequireSiteAdministrator attribute to CustomAction and set it to “True”. For more security, add the following code in the “My page” custom page -
protected override bool RequireSiteAdministrator {
get { return true; }
}
Posted by Sanjay Sansanwal at 3:00 pm 0 comments
Labels: MOSS
To find the publickeytoken of an assembly, I use to drag and drop the assembly to C:\Windows\Assembly folder and then view the properties.
The better way is to use SN.EXE located under “C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin” folder.
You could integrate this tool into VS IDE using external tool features.
Now, you have a new entry listed in the Tools menu titled Get Public Key as shown in the following screenshot:
Assuming you have a project open that has been configured to be signed when built, and you've built it at least one time, selecting the new Get Public Key menu item from the Tools window to get the public key token and blob in the Output window.
Here you have assembly publictokenkey in second entry
Posted by Sanjay Sansanwal at 2:12 pm 2 comments
Labels: Dot NET
I created a new VM and installed Visual studio 2005. To my horror, I could not found the Create GUID tool in Visual Studio.The Create GUID tool is often found under the Tools menu.
To fix this, I performed the following steps:
The actual file for generating GUID is guidgen.exe which would be located at “C:\Program Files\Microsoft Visual Studio 8\Common7\Tools”.
I realised that this file is missing as I didn’t installed Visual C++. I was trying to be smart :-)
Posted by Sanjay Sansanwal at 2:03 pm 0 comments
Labels: Dot NET
To add filter web part to your web part list:
1. Click on the new button in the web-part gallery and select the correct classes from web part gallery
2. If you can’t find them in web part gallery, upload the Web Part definition files from %CommonProgramFiles%\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES\BizAppsSiteTemplates\dwp.
For more information about Filter web part Click here
Posted by Sanjay Sansanwal at 3:15 pm 0 comments
Labels: MOSS
MOSS 2007 comes with a number of filter web parts that makes it really easy to filter your SharePoint lists by connecting filter web parts with list view web parts.
Note: These are only available in MOSS enterprise edition and could only be applied to “All Items” view or to view configured as “Standard View” type
I would walkthrough in this tutorial to filter a list items based on User Location (mapped to Office profile property in the User Profile repository).
Background
There are list of courses stored in a custom list called “Courses”. The requirement is to display courses only available in current logged user’s location. The easiest way would be to create a view on the list and set the filters. Ironically, there is not inbuilt [Location] attribute like [Me] or [Today]. You could filter the view on [Me.Office] as shown below
The other way is to use the Current User Filter. With the Current User Filter you can filter the contents of web parts by using any property of the current user.
Steps
1. Create a List called Courses
|
2. Add couple of items to this list with different location. Make sure one record have location same as your location. In this example, current user’s Office profile property has value as “Melbourne”.
3. As the list page is a web part page, you could easily add web parts to this using User Interface.
4. Click Site Actions -> Edit Page
5. On the top of the list, click “Add a new Web part” and select web part “Current User Filter”
6. Edit the newly added web part “Current User Filter” by clicking Edit -> Modify Shared Web part
7. Click “SharePoint profile value for current user” and select “Office” from dropdown
8. Press OK.
9. Now, we need to make a connection between this web part and courses list. On “Current User Filter” web part, click Edit -> Connections and Select Courses
10. You would be prompt with a dialog box, select the List field which need to be mapped to the User’s Office attribute.
11. Click Finish and Exit the edit mode. You would now only see the items in list which have location same as your Office.
Posted by Sanjay Sansanwal at 3:07 pm 6 comments
Labels: MOSS