Wednesday, December 09, 2009
The Managed Metadata Service or Connection is currently not available. The Application Pool or Managed Metadata Web Service may not have been started. Please Contact your Administrator.
To resolove, I had to apply the hot fix KB976462 and restart my machine.
My first Hot Fix for SP2010 :-) . Its actually a hotfix for the .NET Framework 3.5 Service Pack 1 and a prerequisite for SharePoint 2010 beta.
I am now able to view the Term Store Managemet Tool, and this should allow me to move ahead with my exploration.
Sunday, November 29, 2009
Parameter Name: relativePath
As a work around, I saved the entire site as template, saved the WSP file to my machine, and then imported only the required Workflow into Visual Studio. This workaround is described here:
Any other alternatives to overcome the Parameter Name: relativePath error?
To begin, you need to active go to Site Actions, Site Settings, Site collection features, and activate "SharePoint Server Enterprise Site Collection features".
On your page where you want to display the chart, click on Edit Page, Insert, Web Part. The web part is found under the Miscellaneous section.
Select your X and Y fields and click Finish.
There is a range of options. I will select "Pie" under Chart Type Categories.
I plan to show a legend, so I decided to set the Width to be double of the Height. I selected the following options:
Theme: Light Steel Blue
Chart Width: 800 px
Chart Height: 400 px
Chart Image Format: Jpeg
Note that the chart image type will decide the image type rendered on the page.
Check "Chart Title" and "Show Legend".
Click on "Edit Web Part" to review and change the chart and other web part settings.
For basic charts and graphs scenarios, it is likely to replace Excel Services and SSRS. What do you think?
So simple, yet so powerful.
Friday, November 06, 2009
Let’s program using the Client OM for a Win Forms application.
Add a reference to the following assemblies:
Add a reference to the following namespace:
Add 2 list boxes and a button onto your form.
To populate the List and the List Items, add the following code to the button click event:
//Executes the current set of data retrieval queries and method invocations
foreach (List list in site.Lists)
Note that you need to first Load(), and only then call ExecuteQuery().
Accessing the list item without calling Load and ExecuteQuery throws CollectionNotInitializedException.
Thursday, November 05, 2009
There are 5 types of events which can be captured:
1. List Events
2. List Item Events
3. List Email Events
4. Web Events
5. List Workflow Events
After events can now be synchronous (Before events are synchronous and After events are asynchronous by default).
Visual Studio 2010 provides Event Receiver template. It will help developers quickly jumpstart the process.
The list of events is given below.
SPListEventReceiver: Provides methods to trap events that occur for lists.
ListAdded : Event that occurs after a list is added to a Web site.
ListAdding : This event is registered at the Web site or site collection where the list is created.
ListDeleting : Event that occurs before a list is deleted.
ListDeleted : Event that occurs after a list is added to a Web site.
FieldAdded : Occurs after a field link is added.
FieldAdding : Occurs when a field link is being added to a content type.
FieldDeleted : Occurs after a field has been removed from the list.
FieldDeleting : Occurs when a field is in the process of being removed from the list.
FieldUpdated : Occurs after a field link has been updated
FieldUpdating : Occurs when a field link is being updated
SPItemEventReceiver: Provides methods for trapping events that occur to items.
ItemAdded : Asynchronous After event that occurs after a new item has been added to its containing object.
ItemAdding : Synchronous Before event that occurs when a new item is added to its containing object.
ItemAttachmentAdded : Asynchronous After event that occurs after a user adds an attachment to an item.
ItemAttachmentAdding : Synchronous Before event that occurs when a user adds an attachment to an item.
ItemAttachmentDeleted : Asynchronous After event that occurs when after a user removes an attachment from an item.
ItemAttachmentDeleting : Synchronous Before event that occurs when a user removes an attachment from an item.
ItemCheckedIn : Asynchronous After event that occurs after an item is checked in.
ItemCheckedOut : Asynchronous After event that occurs after an item is checked out.
ItemCheckingIn : Synchronous Before event that occurs as a file is being checked in.
ItemCheckingOut : Synchronous Before event that occurs after an item is checked out.
ItemDeleted : Asynchronous After event that occurs after an existing item is completely deleted.
ItemDeleting : Synchronous Before event that occurs before an existing item is completely deleted.
ItemFileMoved : Occurs after a file is moved.
ItemFileMoving : Occurs when a file is being moved.
ItemUncheckedOut : Synchronous Before event that occurs when an item is being unchecked out.
ItemUncheckingOut : Synchronous Before event that occurs when an item is being unchecked out.
ItemUpdated : Asynchronous After event that occurs after an existing item is changed, for example, when the user changes data in one or more fields.
ItemUpdating : Synchronous Before event that occurs when an existing item is changed, for example, when the user changes data in one or more fields.
SPWebEventReceiver: Provides methods for trapping events that occur to Web sites.
SiteDeleted : Occurs after a site collection has been deleted.
SiteDeleting : Occurs when a site collection is being deleted.
WebDeleted : Asynchronous After event that occurs after an existing Web site is completely deleted.
WebDeleting : Synchronous Before event that occurs before an existing Web site is completely deleted.
WebMoved : Asynchronous After event that occurs after an existing Web site has been moved.
WebMoving : Synchronous Before event that occurs before an existing Web site has been renamed or moved to a different parent object.
WebAdding : Synchronous Before event that occurs before a new Web site is created.
WebProvisioned : Synchronous After event that fires after the Web is fully provisioned and the provisioning process has stopped.
SPEmailEventReceiver: Provides a method for trapping the event when a list receives an e-mail message.
EmailReceived : Occurs after an e-mail message has arrived.
WorkflowCompleted : A workflow was completed
WorkflowPostponed : A workflow was postponed
WorkflowStarted : A workflow was started
WorkflowStarting : A workflow is starting
Note: This documentation is preliminary and is subject to change.
Tuesday, November 03, 2009
It creates a web part (.cs), User Control (.ASCX) and other associated files.
The Web Part maintains a reference to the User Control and loads the same in the CreateChildControls method.
The approach is similar to Return of Smart Part for MOSS 2007, which we used to wrap ASCX file within an web part.
Sunday, November 01, 2009
C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\BIN
From 12\BIN to 14\BIN, thats the only change, as there is no Version 13 (considered unlucky by many).
The new SPMETAL.EXE, which is used to genrate Entity Classes for LINQ to SharePoint, also resides inside 14\BIN.
Below is the object model code snippet to change the settings using object model:
Setting it to On shows the page diagnostics, load time and other information at the bottom of the page.
stsadm -o setproperty -pn developer-dashboard -pv on
stsadm -o setproperty -pn developer-dashboard -pv off
stsadm -o setproperty -pn developer-dashboard -pv OnDemand
Everything that can be done in STSADM should be possible in PowerShell too. You can explore it on your own.
I am wondering if there is an option yet on the UI to manage the Developer Dashboard setting. Anyone knows?
The setting is only at the SPFarm level. It would be better if we we have an option to turn this on at the Site Collection or Site Level.
The above code does not work on the updated SP2010 vesion. Try this instead:
SPWebService cs = SPWebService.ContentService;
cs.DeveloperDashboardSettings.DisplayLevel = SPDeveloperDashboardLevel.OnDemand; //or On or Off
You need to refer to the Microsoft.SharePoint.Administration namespace.
Saturday, October 24, 2009
Well, seems like there were others who asked the same question.
The web part has now been renamed to “Refinement Panel”. Sounds less geeky, but easier for the business users to understand its functionality.
Thursday, October 22, 2009
And it goes without saying that SPD 2007 cannot be used to open SharePoint 2010 sites.
Both SPD 2007 and SPD 2010 can be installed on the same machine, so not a real issue.
Tuesday, October 20, 2009
Stsadme.exe will continue to be supported for back word compatibility. However, if stsadm.exe can do something, Windows Powershell will also be able to do the same. And with higher efficiency most of the times.
Stsadm.exe, good old friend, we will miss you. Rest In Peace
I plan to be a devout student and learn and share my experiences through this blog.
Amongst the range of new features that SharePoint 2010 introduces, it now provides support for multiple browsers.
- Windows Internet Explorer® 7 32-bit
- Internet Explorer 8 32-bit
- Firefox 3.x 32-bit
- Internet Explorer 7 64-bit
- Internet Explorer 8 64-bit
- Firefox 3.x on non Windows operating system
- Safari 3.x
Friday, October 02, 2009
To remove the popup, you need to remove the body onUnload event handler. Sample code snippet to do the same:
document.body.onUnload = "";
You can reduce the code snipped to one line by adding this to the bottom you’re your master page, just before HTML closing tag.
document.body.onUnload = "";
Other option is to go change your IE settings and disable Enable native XMLHTTP support.
Tool->Internet Options->Advanced and disable ‘Enable native XMLHTTP support’
Saturday, September 26, 2009
A work around is to set the column as hidden and read-only, preventing it from being displayed in New and Edit forms. Please note that this is not 100% secure and there are ways to update the values of the hidden columns. SharePoint allows the values for such read only columns to be updated by calling the list web service or through SharePoint Designer Workflows.
The requirement for our intranet portal was that users should not be able to manipulate a particular column through the UI. The security risk was considered acceptable.
The read only property is not exposed through the UI and needs to be set using the object model or calling the UpdateList method of lists.asmx web service.
Sample Code using lists.asmx:
var listService = new ListsWebService.Lists();
The read only column values can be updated through the workflow, and I created a workflow using SharePoint Designer for my requirements.
I hope SharePoint 2010 provides this out of box and this work around is not needed.
Monday, August 10, 2009
We recently had to determine the search queries fired when one used the OOB SharePoint Advanced Search Web Part. This was while working on an implementation of faceted search results, where we were getting different count of search results for Faceted and Advanced Search. The only way to make the results match was make both the web parts fire the same queries, and have similar settings for Duplicates, Noise words and stemming. First I will tell you the queries, and then I will talk about how did I extract them. Searching for my company name “MAQ Software” and selecting “MyCustomScope” forms the queries as:
All of these words:
SELECT WorkId, Rank, Title, Author, Size, Path, Description, Write, SiteName, CollapsingStatus, HitHighlightedSummary, HitHighlightedProperties, ContentClass, IsDocument, PictureThumbnailURL from scope() where freetext(defaultproperties,'+MAQ +Software') And ("scope" = 'MyCustomScope' Or "scope" = 'MyCustomScope')
The exact phrase:
SELECT WorkId, Rank, Title, Author, Size, Path, Description, Write, SiteName, CollapsingStatus, HitHighlightedSummary, HitHighlightedProperties, ContentClass, IsDocument, PictureThumbnailURL from scope() where freetext(defaultproperties,'+"MAQ Software"') And ("scope" = 'MyCustomScope' Or "scope" = 'MyCustomScope')
Any of these words:
SELECT WorkId, Rank, Title, Author, Size, Path, Description, Write, SiteName, CollapsingStatus, HitHighlightedSummary, HitHighlightedProperties, ContentClass, IsDocument, PictureThumbnailURL from scope() where freetext(defaultproperties,'MAQ Software') And ("scope" = 'MyCustomScope' Or "scope" = 'MyCustomScope')
None of these words:
SELECT WorkId, Rank, Title, Author, Size, Path, Description, Write, SiteName, CollapsingStatus, HitHighlightedSummary, HitHighlightedProperties, ContentClass, IsDocument, PictureThumbnailURL from scope() where freetext(defaultproperties,'-MAQ -Software') And ("scope" = 'MyCustomScope' Or "scope" = 'MyCustomScope')
I won’t go into the details of freetext clause or the significance of “+” or “-”sign in this blog. There are other articles on the net which describe the same in great detail.
To extract the queries, I started using Lutz .NET Refelctor and digging into the CoreResultsWebPart, which is found in the assembly Microsoft.Office.Server.Search. The CoreResultsWebPart class is a lazy guy, and relies on Microsoft.Office.Server.Search.WebControls.SearchResultHiddenObject to do most of the work. On closer study of the SearchResultHiddenObject class methods and fields, it can be seen that after composition, the search query gets saved in the field _fullTextQuery
I decided to create a custom web part, which inherits from CoreResultsWebPart, and read the query formed. However, the authors of SearchResultHiddenObject decided to make the class internal and this complicated things a bit. On trying to create an object reference of SearchResultHiddenObject, it gave the expected error message “SearchResultHiddenObject is inaccessible due to its protection level”. Object oriented boundaries can be broken and private and internal fields accessed using .NET reflection. That is what I did to get the above queries.
The approach is similar to the one described in Corey Roth’s blog, but you should write your code in the OnPreRender event. The query is not fully composed when other events earlier in the web part lifecycle are called.
Same logic can be used to find the queries fired by basic or people search, and you can give it a try.