| Michael's profileMichael's Coding DenBlogListsSkyDrive | Help |
|
|
March 08 SharePoint Tips 11 – 20 “Do you know”Another aggregated set of SharePoint Tips, from 11 to 20
Previous 10 are published there February 19 Speaking: “Best Practices of SharePoint Farm Deployment”This month I’m reading my first SharePoint presentation in Sydney (Australia), so I welcome NSW ppl to come to listen to me and to criticize a bit :) I’m planning to run about 3 presentations of “best practices” for SharePoint infrastructure and Development, so this one starts with the basis of how to create the SharePoint farm Detail info below
Topics are:
PowerPoint presentation is available to download in PDF format February 10 SharePoint Tips 1 – 10 “Do you know”The aggregated post of the first 10 posts from the “Do you know” SharePoint Tips series
January 04 SharePoint Managers Tools overviewIn this post I’d like to review existed tools for the SharePoint management. The idea to create this overview appeared after I read that Bamboo solution shipped their own SharePoint analyzer. The first I thought was - “Why do we need another tool, if we already have SharePointSpy and SharePointManager?!” So, let’s start comparing of three tools, which exist on market 1) SharePoint Analyzer from Bamboo Solutions 2) SharePoint Manager from CodePlex
3) SharePointSpy from EchoTechnology
and how those tools functionality differs.
Results: analyzing those tools I found that SharePoint Analyzer and SharePoint Manager provide you the richest functionality to manage your SharePoint environment. I can’t name the best tool, because those tools have different target audience and must be used together. SharePoint Analyzer from Bamboo solutions provides rich and good, structured overview of your SharePoint farm for administrator/infrastructure perspective – detailed info about servers, web applications, logs, and etc. Good usability, grouping and detailed information across all your farm servers, but there are few useful info for developers. SharePointSpy is absolutely different tool – it stays away from infrastructure, providing your deep info about sites, features, site definitions and etc., allowing your to export different schemas xml. Really powerful tool for developers, who need deep dive inside SharePoint stuff. SharePoint Manager locates between administrator vs developer poles. It provides you almost the same functionality as SharePointSpy, but has a lot of information for infrastructure guys/administrators as well. My choice: combination of SharePoint Analyzer for maintenance and SharePoint Manager for development. But, if those three tools were shareware, then I’d chose SharePoint manager for its balance between admin and developer functionality.
December 24 Why Content Query Web Part (CQWP) doesn’t return all results.I’ve seen several cases, when people use CQWP and surprises when it doesn’t return all items in standard mode and returns all necessary items in “edit” mode. I find this topic is not being documented enough anywhere. So, CQWP ignores following items from your queried data:
Those scenarios are “behaviour by design”, and I found such behaviour logical. User’s are working on their items, and work in progress – you shouldn’t show such items Workaround: set “UseCache” property to “false”. Cite from SharePoint team:
So, my recommendation is to revise your approach to return published and checked-in stuff only.
Mirror: Why Content Query Web Part (CQWP) doesn’t return all results. December 17 SharePoint BDC Permission InheritanceIn these days I was working on the search issue in SharePoint 2007, which led me to the interesting behaviour of BDC Permissions. We had the following errors in MOSS crawl log
What it means, is that search can’t crawl BDC content, because owner of the BDC application was removed. Diagnosing this issue we found that user who imported BDC application doesn’t work at us anymore, and he was removed from Active Directory. So, that’s why BDC not accessible. You can find the full descriptions of this behaviour there http://k2distillery.blogspot.com/2008/06/bdc-crawl-missing-security-identifier.html So, the workaround promised be simple – just “Manage Permissions” for this BDC application, removing user from list of BDC Entry owners and from BDC Catalog Permissions. That’s what described in that article. But reality is far from it :) The actual behaviour is whenever you navigate to “Manage Permissions” you got “Error: Access Denied" screen. The surprising part of this is that my user is
Well, I have all permissions, but I still can’t access user’s BDC application. I didn’t know one thing – BDC Catalog permissions are INHERITED permissions. It means that you need explicitly copy all BDC permissions to your user :) Really bizarre. Solution: Navigate to BDC Catalog Permissions page, select your admin user and click “Copy all permissions to descendants”. Detailed instruction is there: http://blogs.msdn.com/mutaz/archive/2008/12/14/ssp-admin-cannot-manage-existing-bdc-applications.aspx
Hail to Mutaz, helping to nail down this issue. Mirror: BDC Permission Inheritance November 25 TypeMock - first unit test framework for SharePointTesting SharePoint was always an issue, because SharePoint has number of classes that are sealed and/or does not have public constructors. SharePoint's API consists heavily of sealed classes and classes with internal constructors. None of existed unit-testing frameworks provided ability to mock such classes. Guys from TypeMock (http://www.typemock.com) did fantastic work, providing really powerful framework to mock such classes, which were not covered with existed frameworks, like RhinoMock and Moq or NUnit mocks. And today, they announced Isolator for sharepoint:
Info for masses, how to get free licence:
PS: I’m using this framework in these days and found it really handy. Moreover, guys from TypeMocks are open for communications and framework extensibility if your find something what’s missed or you wanted to have there. November 08 Practical SharePoint White PapersGuys from Combined-Knowledge published white papers which are really practical and illustrated with step-by-step instructions. Good stuff. Btw, these guy runs SharePoint Training around the Australia
October 18 Best Practices to plan and configure your SharePoint Farm across corporate infrastructureIn my previous post I described list of documents you need to manage for your SharePoint engagement. In this post I’d like to publish my “best practices” for planning and configuring your SharePoint Farm across organizations. There are number of documents, describing such requirements for SharePoint Farm, but those documents are usually writing without taking into account your infrastructure scope. You never install SharePoint in isolated environment, and what you setup is usually interfere with the whole organization strategy and infrastructure design. Infrastructure
Post-Installation Tasks
That's all. I welcome to hear some of yours "best practices", if you have any Mirror: Best Practices to plan and configure your SharePoint Farm across corporate infrastructure October 16 Tips to create a Site Collection in new Content DatabaseIntroKen Zheng posted a good overview of how to create a Site Collection in new Content Database http://littletalk.wordpress.com/2008/10/10/creating-a-site-collection-in-a-new-content-database/ I’d like to add some notes to Ken’s post, regarding planning site collections and sub-sites among different content databases. There are some reasons, why you could have several content databases:
Scenario - Data UsageThe major advance of several content databases is splitting your site collection and sub-sited among several content databases based on the content type and content usage. For example, you can have media sites and media data stored in separate content database and separate SQL server, which is tuned, indexed and partitioned to work with BLOB data; or sites which are used for document management, in separate SQL server with content database optimized for textual information. If you will store different type of content information inside one big single content database in won’t help you to use all advantages of SQL Server to optimize your data usage. Scenario – Backup/RestoreHaving several content database makes you data restoration faster, because you need to restore only that content database, where origin site/data located. Scenario – DRUsually when you implement DR strategy your DR box locates outside current network and outside the current organization, and you could have slow network connection there (reasonably slower then inside your network). So, setting SQL mirroring takes a lot of time if you have very big database. Moreover, with the different content databases you can leverage the importance of your data and mirroring to different locations, for example mirroring your vital financial data in one content database to the box outside your enterprise, and other content databases inside your network. Tips and ToolsKen describes how to create new sites in new content databases, but what if you already have 200Gb content database and what to split and reorganize your data across several new content databases?! SharePoint doesn’t provide OOTB UI features for this. The standard way to reorganized you data for the sub-sites is to use STSADM tool (I will discuss moving site collections separately). The way to move your sub-sites to new content database is to follow the next steps
Now you will have you sub-site in new content database. It’s not very user friendly approach, and is an error proned a bit. But there is one small tool - SharePoint Administration Tookit, which helps you to to reorganise the whole site collections. This feature will install a new section inside “Applications”and you can move your site collection via Central Administration interface. ResumePlan you site collections / sub-sites content with you database administration guys Take into account that you can’t split site and site content between content databases, for example you can’t specify storing all site’s *.avi files in separate content db. I hope it will be changed in the next version of SharePoint, but now site and site content are stored together. Mirror: Tips to create a Site Collection in new Content Database
September 28 SharePoint MirroringThere are number of posts and documents about how to setup mirroring of SharePoint content DB, but when I started my mirroring I stumbled over number issues, which I probably missed in documentation and which took some of my time to find out what was wrong. So in this post I’d like summarize all important parts of setting SharePoint mirroring. Refer to detailed description in the end of this post to get the initial understanding.
Troubleshooting: 1) User SQL Management Studio, right mouse click on DB, Tasks->Launch Database Mirroring Monitor to check the status of your mirroring databases. 2) You can have the following error “Cannot open database "<…>" requested by the login. The login failed. Login failed for user '….'.” when you try to use “stsadm –o addcontentdb …”. This happens when you DB not in failover status. You need to make your DR failovered (active) and only then add content DB
That’s all. I hope this post will save some of your time when you start your SharePoint mirroring.
More reading:
Mirror: SharePoint Mirroring Starting SharePoint solution and planning your documentationWhen a new SharePoint project is about to start I use the following steps to design and plan solution
Take into account that SharePoint SDLC differs from standard development, and not all projects require those steps. Mirror: Starting SharePoint solution and planning your documentation September 27 MS officially supports SharePoint virtualized environmentToday @jthake posted info about the recent announcement from Microsoft that they finally started to support “Virtualized SharePoint environment” for
What does it mean for end-users, developers or IT guys?! Nothing. It mostly the question of taking the official decision for managers, what and where will be deployed. Because in case of any problems Microsoft will help you in troubleshooting, but not for SharePoint under one of virtualized environment. You must had a installation on physical boxes. Now it’s now an issue. They announced support of virtualized SharePoint environments
Mirror: MS officially supports SharePoint virtualized environment September 19 SharePoint 2007 migration tipsWorking of migration of SPS to MOSS 2007 in these days and would like to share my experience about number of small tricks, which really annoys you if you don’t know them, and which could save hours during your next migration
Update: be very careful with renaming database, because if you will do it wrong way you DB is completely screwed, and there is no way to return it back. Refer to this document http://blogs.technet.com/corybu/archive/2007/06/01/detaching-databases-in-moss-2007-environments.aspx about the right process how to rename database Update 2: Make sure that you have latest SP installed for your SharePoint 2003 Update 3: Check your publishing pages (if you have any) by trying to edit them. Sometimes they can be broken after migration. You need to use these approaches – one and two to fix it. You are welcome to share your migration tricks which saved your time
Mirror: SharePoint 2007 migration tips September 02 SharePoint Infrastructure Update (WSS/MOSS) and exception with “Blocked file types” pageAfter installing SharePoint 2008 (WSS/MOSS) Infrastructure Update from July 2008 you may find that “Blocked file types” page is broken (Central Administration –> Operations –> Blocked file types). Albeit it worked before, 10 mins ago, but now you end up with the following exception
What it means, that SharePoint can’t resolve your WebApplicationID (GUID of your site) from Content DB. The fully qualified URL for “Blocked file types” looks like “http://<CentralAdmin>:<port>/_admin/BlockedFileType.aspx?WebApplicationId=fa221a6a-42a2-4a09-8aac-76a31f160880”. I have no idea why SharePoint can’t resolve web application after Infrastructure Update, something wrong happened and your site just can’t be found. I didn’t test with SQL Profiler, but expect that nothing returning from Content DB To fix this you need just to create new Web Application :) That’s all. At this time the Content DB tables will be updated with new web app and GUID, and “Blocked file types” will start work again.
Mirror: SharePoint Infrastructure Update (WSS/MOSS) and exception with “Blocked file types” page August 10 Deploying SharePoint Web Parts as a part of PageLayouts in MOSS 2007Web Parts are an important and everywhere used part of SharePoint. Web Parts are documented pretty good and there are several sources describing as just ASP.NET WebParts (Darren Neimke book) and some resources about Web Parts in SharePoint as well. But in reality SharePoint WebPart specific stuff is not properly documented, and in this post I’d like to publish some tips regarding Web Parts in SharePoint General Info Not all Web Parts are inherited from System.Web.UI.WebControls.WebParts.WebPart class. Some of them comes from Microsoft.SharePoint.WebPartPages.WebPart, which is inherited from the System.Web.UI.WebControls.WebParts.WebPart now. When you develop your own Web Parts, in mostly cases you need to inherit from System.Web WebPart class Finding the connections For some tasks you might handle the Web Part connection/disconnection programmatically. For example, connect your Web Part via code or via Page Layouts. To do this you need to know the Consumer and Provider names. It’s not the problem for your Web Parts, but how to find the Provider name for the out-of-the-box Web Parts?! For this you need to use Reflector. First, to know the class name of SharePoint Web Part you need just put any Web Part to the page and export it to XML. In that XML you will find the assembly and class name. After that open that assembly in Reflector and navigates to the class you need to get Provider name. Scrutinize that Web Part class to find the connections and name of Provider connection. Connection may be not exactly in that class, but in one of the base classes. For example for Page Filter Web Parts the Provider name is “ITransformableFilterValues” Deploying Web Parts with connections If you deploy you pages and want to have Web Parts being already connected for each new page user creates, then you need to connect Web Part via XML description inside Page Layout. Connection consists from 3 parts:
So, let’s start:
1: <SPWebPartConnections> 2: <WebPartPages:SPWebPartConnection ID="g_myConnectionName" 3: ConsumerConnectionPointID="IFilterValues" ConsumerID="WebPartA" 4: ProviderConnectionPointID="ITransformableFilterValues" ProviderID="WebPartB"> 5: <WebPartPages:TransformableFilterValuesToFilterValuesTransformer MappedConsumerParameterName="Parameter"> 6: </WebPartPages:TransformableFilterValuesToFilterValuesTransformer> 7: </WebPartPages:SPWebPartConnection> 8: </SPWebPartConnections> Let’s review the “blue” selections, because it’s where connection magic happens
10. Save the page layout. Go to SharePoint and create the new page based on that page layout. After page will be created you can find that your Web Parts are already connected. Job done!
Take into account, that you can’t change Web Parts connection for pages created for the Page Layouts with predefined Web Part connections.
Mirror: Deploying SharePoint Web Parts as a part of PageLayouts in MOSS 2007 July 09 Moving ASP.NET master.page to SharePointIn these days SharePoint become more and more popular. There are number of web project which starts directly in SharePoint, but however a lot of project remains out the SharePoint scope, and exists as pure ASP.NET application. The one of the common task of migrating ASP.NET application to SharePoint is changing the site landing page to become SharePoint page. But it’s where the problem starts. ASP.NET applications tend to consume different modern tools and technologies like ASP.NET MVC, SilverLight, URL Rewriting and others which seems to be very common in pure ASP.NET development, but could be the potential problems in SharePoint world. There are three thing you need to concentrate on 1) master.page
2) CSS
3) Web.config
4) Code
Mirror: http://msmvps.com/blogs/laflour/archive/2008/07/10/moving-asp-net-master-page-to-sharepoint.aspx June 13 SharePoint Designer removes tags when saves page layout - “file system” feature workaroundIn the current project we are using SharePoint Designer 2007 intensively to create number of PageLayouts, especially to put WebParts there and pre-configure WebParts connections. SPD is not such a bad tool, because there is no alternative for this. But time to time it really buggy and awful that you start thinking if it passed QA team before being released. (event SP1 doesn’t solve a lot of common crucial bugs, which stops you using SPD at all) The most disgusting stuff of SharePoint Designer is that it formats your pages markup without asking you. And what’s worse it REMOVES some tags. I really can’t understand that behaviour – WHY it removes what you typed when you save document?! Recently, we stumble over the very nasty thing of SPD – accidental formatting. We have a PageLayout with several web parts on the page and we created <SPWebPartConnections> section to predefine WebParts connections. But whenever you save your document, SPD for some reasons removes some of your <SPWebPartConnections>. We spent about 2 hours to understand any dependencies or logic, but without success. It seems that they have some kind of RAND which selects which of the SPWebPartConnections tags to remove. We tried to install several hotfixes for SPD – but nothing works. So, the only way is to use other tools, like Visual Studio. But there is a problem. If you are edit your pageLayout in Visual Studio and want to test it, you need to re-deploy your pagelayouts each time, because VS doesn’t support check-in/check-out to SharePoint Content DB. But there is alternative way to edit your pages and have check-in support from the Visual Studio. SharePoint has very cool “file system” feature. It means that you can navigate to your PageLayouts from explorer, open them in any editor and save it back. All your changes will be stored in Content DB(!!) To do this your need to open Windows Explorer and navigate to My Network Places. On the left side you will see the “Add Network Places” item. Open it and type there “http://<yoursite>/_catalogs/masterpage/”, type the name of your network folder like “MySite PageLayouts” and press OK. Now, if you open the “MySite PageLayouts” item from Windows Explorer->My Network Places you will see the content of your “_catalogs/masterpage/” SharePoint folder. And now your can open your masterPage or PageLayouts in any editor, edit them and save them. All changes will be stored into ContentDB. But don’t forget to checkout your file before editing (via Sharepoint or SPD) So, this trick allows you to edit any SharePoint files and forget about SharePoint Designer issues Mirror: SharePoint Designer removes tags when saves page layout - “file system” feature workaround June 05 Page events stop working after using output stream for binary downloadIn my previous SharePoint projects I've met the situations when you need to outstreem some binary files, like PDF file or something else, but when you do this by the standard way (how you used to do in normal ASP.NET site) you found that page is "dead" after you streamed you file to the client. By "dead" I mean that it doesn't respond to any events, and you can't use this page. The problem lies in the SharePoint JavaScript files, which are integrated into the each web page, and seems that they protect you from unnecessary double-posts. But unfortunately such behaviour breaks your stream output. I didn't have a change to investigate this problem in details, to find out what exactly affects on this, and always solved this by putting stream out in the new popup window. In these days on SharePoint NGs this question was risen and "andyspears" posted a work-around, how to change the SharePoint JS and return the normal behaviour back. 1: //1) Set your button's client-side click event to: 2: "exportRequested=true;" 3: 4: //2) register the following JS: 5: string beforeSubmitJS = "\nvar exportRequested = false; \n"; 6: beforeSubmitJS += "var beforeFormSubmitFunction = theForm.onsubmit; \n"; 7: beforeSubmitJS += "theForm.onsubmit = function(){ \n"; 8: beforeSubmitJS += "var returnVal = beforeFormSubmitFunction(); \n"; 9: beforeSubmitJS += "if(exportRequested && returnVal) 10: {_spFormOnSubmitCalled=false; exportRequested=false;} \n"; 11: 12: //beforeSubmitJS += "alert(returnVal + '\\n' + _spFormOnSubmitCalled);"; 13: beforeSubmitJS += "return returnVal; \n"; 14: beforeSubmitJS += "}; \n"; 15: 16: //beforeSubmitJS += "alert(theForm.onsubmit);"; 17: this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alterFormSubmitEvent", beforeSubmitJS, true); Thanks AdnySpears, good work! Mirror: Page events stop working after using output stream for binary download May 28 Subclassing Content Query Web Part to override CAML queryThe Content Query Web Part (CQWP) in MOSS is one of the popular out-of-the-box Publishing components which is used in content management sites, allowing you to get results from different sources. But sometimes out of the box functionality is not enough to meet your requirements, and you need to customize CQWP. There are several resources describing how to do this - 1, 2, 3, 4 The most important features which are missed in CQWP are:
To implement these functionality you need to subclass ContentByQueryWebPart class and override several methods. Below I will describe what exactly need to be done to achieve desired behaviour. Query Override To have custom CAML query in your Web part you need to override CreateChildControls base method. You can find samples how to do this in the references above, but it's done so implicitly, that you can easily spend hours to find out why you code doesn't work and gives you different errors The crucial part is in the way sending the query to the base class within overrided CreateChildControls 1: protected override void CreateChildControls() 2: {3: this.QueryOverride = customQueryString; 4: 5: base.CreateChildControls(); 6: 7: QueryOverride = string.Empty; 8: 9: CommonViewFields = string.Empty; 10: }First, you need to set your custom query to the "this.QueryOverride" to inform base class about query - line 3 Second, call base CreateChildControls() allowing your query being executed - line 5 Third and last - CLEAN query and view fields properties - line 7,9. Without this step you will get errors when open your Web Part in edit mode Enabling Connection The Content Query WP doesn't accept any connections by default. You need to implement this too. Everything you need to to is just add ConnectionConsumer attribute. But trick in setting the right attribute which is used in Parameter dialog box, when you connect two web-parts. 1: [ConnectionConsumer("Another WebPart", "IFilterValues", AllowsMultipleConnections = true)] 2: public void SetConnectionInterface(IFilterValues filterProvider) 3: {4: if (filterProvider != null) 5: {6: // save provider with values 7: providerValues = filterProvider.ParameterValues;8: _filterProviders.Add(filterProvider); // variable declaration is List<IFilterValues> _filterProviders = new List<IFilterValues>(); 9: List<ConsumerParameter> parameters = new List<ConsumerParameter>(); 10: 11: // add params 12: parameters.Add(new ConsumerParameter("param1", 13: ConsumerParameterCapabilities.SupportsSingleValue | 14: ConsumerParameterCapabilities.SupportsEmptyValue));15: parameters.Add(new ConsumerParameter("param2", 16: ConsumerParameterCapabilities.SupportsMultipleValues | 17: ConsumerParameterCapabilities.SupportsAllValue | 18: ConsumerParameterCapabilities.SupportsEmptyValue)); 19: 20: filterProvider.SetConsumerParameters(new ReadOnlyCollection<ConsumerParameter>(parameters)); 21: 22: } 23: }Method name can be any, but pay attention which provider you are using . WebPart providers send data via different provider interfaces, for example when you are working with Filtering web parts (like "Current User Filter" web part) then you need to "listen" your incoming connections via IFilterValues (thx Mutaz for this findings), for other WB it could be IWebPartField or IWebPartRow. If you are expecting to get data from WP via unsupported provider you connection link will be dimmed Practical Sample @d2design kindly asked to provide practical sample, for example how to use current user as a keyword :) Actually, it's good example which shows how use both features I described. To do this you need to have:
TIPS:
Mirror: Subclassing Content Query Web Part to override CAML query |
|
|