Thursday, October 9, 2008

Web Part Maintenance Page

In some cases we need some way to close the offending web parts.In that case we go to the Web Part Maintenance Page.
For the Web Part Maintenance Page is to append "?contents=1" to the end of your web part page's URL and loading that page.
For example:

Monday, October 6, 2008

How to add Audience Targeting to a link at QuickLaunchBar?

I strugle a lot for setting a group to a link.So that the group users only can see the link at quicklaunchbar.
I would like to share a few lines...
if (userGroup == "Publisher")
node.Properties.Add("Audience", ";;;;" + groupName1);
else if (userGroup == "Certifier")
node.Properties.Add("Audience", ";;;;" + groupName2);

Sharepoint Interview questions

1-Question: can you create page layout templates in Visual Studio?Answer: Yes, but longer answer in the Page Layout module
2-Question: When using SharePoint designer for Page Layout Templates can you add code behind or reference an ascx file with a dll?Answer: You can... unfortunately it's not wired together as easily as you have when bulding ASPX pages in Visual Studio 2005. So what you do is create a class library and then specify which class the page inherits from in the Inherits attribute within the page's directive.
3-Question: Can we get the code for the "Minimal "publishing site template?Answer: Sure... just change the WSP file extension to CAB and you can easily extract it and see the contents. WSP's are just CAB files renamed as WSP's.
4-Question: I missed the extra step you did in extending the existing web app? did you just change the port?
5-Question: So the customized pages need to be placed under MPG(Master page gallary) & is ASP.Net master page same as MOSS master page?Answer: (1) If they are created using SPD, all masters and page layouts must be in the MPG... they can't be anywhere else. Once you open them and edit them, when you save them, they stay in the MPG as customised. (2) yes, you just have to have the sharepoint placeholder controls in your master page.
6-Question: is it possible to customize TOC for Press Releases by showing first couple of lines per press release?Answer: Yes... you'd just use the same technique you use for the Content Query Web Part by modifing the XSLT files or creating your own custom XSLT.
7-Question: I use createchildcontrols but find that sometimes it does not have values on post back so I have had to use oninitAnswer: At times you do need to add things to OnInit to register event handlers and such, yes that's correct.
8-Question: 1- How do you debug webparts? 2 - Is it performance consuming to have 3 content query webpart on a page (for the welcome page for an internet site)?Answer: (1) you manually attach the debugger to the w3wp.exe process...
9-Question: What are the best scenarios to use 1)Web Parts, User Controls, Application Pages please compare and contrast.Answer: Web Parts are good as "little applications", such as aggregation controls. In SharePoint we typically don't build many user controls, but you can do it. However, there's nothing special about SharePoint in deciding when to build user controls vs. Web Parts... it's the same decision process you'd have in an ASP.NET 2.0 site. As for application pages (which are deployed to the _layouts directory), these are good for pages you want to be avaialble to ALL sites in your farm as all sites share the same _layouts path.
10-Question: If I have an asp/net application (ie. showing mortgage rates), how do I install this in MOSS? Do I use WebParts or is there another technique?
11-Question: How can we better link lists together, we have primary keys in DBMS.. what about SharePoint lists/DocLibs?Answer: there's no relationship between sharepoint lists... but you can enforce this with event receivers.
12-Question: Is it possible to use infopath and aspx pages in the same workflow?Answer: Hmm... If you can use InfoPath forms, then you should beacuse they do so much heavy lifting for you!
13-Question: How can we deal with cases in which the approver did not respond in a timely manner?Answer: There are activities in the base activity library in WF that you can use to wake up your activity after a specified time... within this activity you can check how long it's been pending and either give them a reminder slap via email or you can change the approver and reroute it. But you'd have to this using custom workflows.