Microsoft
When you drop the default database of the farm Service Account…
by liquidpooled on Nov.14, 2008, under Microsoft, Office, SQL Server 2005, Sharepoint Server, Windows SharePoint Services
When cleaning up a number of older databases in a QA/Staging environment (databases dating back to 2003), we managed to delete the default database for the SharePoint database system account. After deleting the database, the user will longer be able to perform actions on the SQL instance (login, view databases, etc.) when logging on through Management Studio. To fix this error, log on to your SQL server as another administrative user (like the “sa” account), and execute the following:
sp_defaultdb 'SQLSERVER\dbuser', <DEFAULT DB>
Replacing <DEFAULT DB> with the new default database name.
Tip: JavaScript to enable opening links in a new window in SharePoint
by liquidpooled on Nov.13, 2008, under Office, Sharepoint Server, Windows SharePoint Services
There are times when developing in SharePoint where you will be required to modify existing links on a page to make those links open in a new window (Document Library, Links List, etc.). There are times when the original anchor tag carries an “onclick” event of “GoToLink(this); return false;”. The original “GoToLink” function will not allow for opening even links with a modified target in a new window. The following is a piece of JavaScript that will allow for overriding the original “GoToLink” function.
Note: For those links where I truly wish to override the “GoToLink” behavior, I attach a custom attribute to the anchor to be sure it is truly a link I have manipulated.
//Create a custom GoToLink function
var _origGoToLink = GoToLink;
GoToLink = function(elm) {
if (elm.href == null)
return;
var ch = elm.href.indexOf(\"?\") >= 0 ? \"&\" : \"?\";
var srcUrl = GetSource();
if (srcUrl != null && srcUrl != \"\")
srcUrl = ch + \"Source=\" + srcUrl;
var targetUrl = elm.href + srcUrl;
if (elm.getAttribute('cnWebPartsHref') != null) {
//Use window.open rather than window.location
window.open(STSPageUrlValidation(targetUrl));
}
else {
window.location = STSPageUrlValidation(targetUrl);
}
}
Locating all of the Web Parts on the Current Page (C#)
by liquidpooled on Nov.13, 2008, under .NET, MSDN, Microsoft, Office, Sharepoint Server, TechNet, Visual Studio 2005, Visual Studio 2008, Windows SharePoint Services
The following snippet allows for locating all of the web parts on a given web part page (the sample is targeted at web parts of the type Microsoft.SharePoint.WebPartPages.ListViewWebPart)
string webUrl = SPContext.Current.Web.Url;
using (SPSite site = new SPSite(webUrl))
{
using (SPWeb web = site.OpenWeb())
{
SPLimitedWebPartManager manager = web.GetLimitedWebPartManager(this.Parent.Page.Request.Url.ToString(), System.Web.UI.WebControls.WebParts.PersonalizationScope.Shared);
SPLimitedWebPartCollection webPartColl = manager.WebParts;
for (int i = 0; i &amp;lt; webPartColl.Count; i++)
{
if (webPartColl[i].GetType() == typeof(Microsoft.SharePoint.WebPartPages.ListViewWebPart))
{
// do stuff
}
}
}
}
So you want to learn about SharePoint?
by liquidpooled on Nov.10, 2008, under .NET, MSDN, Microsoft, Office, Sharepoint Server, Visual Studio 2005, Visual Studio 2008, Windows SharePoint Services
If you’re looking for a primer in programming with SharePoint, the following are a few good resources provided by Microsoft:
- MSDN Ramp Up
- From the site: Ramp Up is a free, online, community-based learning program, with a number of different tracks that will help you build your portfolio of professional development skills. Ramp Up has a solid foundation of premium technical content from subject-matter gurus, and provides easy-to-access content in a variety of forms that guide you in learning the important skills
- SharePoint Developer
- A primer series on developing with SharePoint from Microsoft.