What master page is my sharepoint site using
Submitted by sami on Wed, 11/05/2008 - 12:53This is actually pretty simple, but it took me a few minutes to find it, so thought I'd jot it down.
I needed to change the master page for my site, but it wasn't using the one I thought it was. So, I went to Site Settings-->Look and Feel-->Master pages. That told me which Master Page the pages in the site were deriving from. I could then go to the Master page gallery and make the change.
SharePoint Web Parts aren't Populated in Gallery
Submitted by sami on Mon, 10/20/2008 - 14:59I've no idea what the deal was, but a client's SharePoint site lost all of the Content Editor Web Parts in their My Sites.
The thing about My Sites is that each individual one is a site collection--so it's not as though populating the gallery in the parent site will help restore the web parts.
Thanks to these two articles, I wrote a quick program to re-populate the gallery:
http://jasear.wordpress.com/2008/07/06/programmatically-adding-a-web-par...
http://blog.rafelo.com/2008/07/iterating-through-sharepoint-web.html
The code was pretty simple with that help:
SPWebApplication webApp = SPWebApplication.Lookup(new Uri(sSite));
FileInfo f = new FileInfo(sDWPFileLocation);
FileStream s = f.Open(FileMode.Open, FileAccess.Read);
//Execute any logic you need to against the web application
//Iterate through each site collection
Handy Error Handling Code
Submitted by sami on Mon, 10/06/2008 - 14:48I'm bookmarking this site: http://www.c-sharpcorner.com/UploadFile/scottlysle/EventAndErrorLogging1... It's an easy cut and paste code for writing to the event viewer.
using System.Diagnostics;
public class EventLogger
{
public New()
{
//default constructor
}
...
Like the ErrorLogger.cs class, this class contains only a single function used to write directly to the event log: (modified to fit on this page)
//*************************************************************
//NAME: WriteToEventLog
//PURPOSE: Write to Event Log
//PARAMETERS: Entry - Value to Write
// AppName - Name of Client Application. Needed
// because before writing to event log, you must
// have a named EventLog source.
// EventType - Entry Type, from EventLogEntryType
Hiding a column in a SharePoint Document Library
Submitted by sami on Fri, 10/03/2008 - 13:33I needed to hide a column and make another column required in a document library. The option wasn't available when I just tried to edit the column. Thanks to a forum post on a paid service, I figured out the process.
1. Go the document library's setting page.
2. Click "Advanced Settings".
3. Check Yes for question "Allow management of content types?". Click OK.
4. Now you should see a Content Types section on the settings page. Click the only one (most likely named "Document") there.
5. Click the field for Description and you will see the "Change Content Type Column" page.
6. Change Optional to Hidden (or required if you want that instead). Click OK.
7. (Optional step) Go back to picture library advanced settings page, Check No for question "Allow management of content types?".
siteCollection returns permissions error
Submitted by sami on Tue, 09/30/2008 - 08:28I was trying to get the subwebs of a site collection by using AllWebs(), but was getting a permissions error when running the code as a non-Admin, even though that user had read permissions on all of the subWebs in the collection.
Thanks to a helpful person on a BB, the solution was to use GetSubWebsForCurrentUser() (http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spweb.getsu...) instead of AllWebs().
Removing HTML from XSLT in SharePoint List
Submitted by sami on Wed, 09/24/2008 - 14:50I needed to include a "Person or Group" list element into an XSLT view of the document library. The problem when I did this was that it displays the HTML markup rather than rendering the HTML.
To fix this, I found this handy xsl:template here: http://dotnetslackers.com/Community/blogs/kaushalparik/archive/2008/08/3...
Worked a treat and took way less time than writing the template myself would have. (One thing to note: you'll want to use "@" in front of the field name you are replacing--in the example this is "DescriptionField".)
Sharepoint Parser Error After Adding Telerik radEditor Web Part
Submitted by sami on Tue, 09/23/2008 - 09:10This morning I installed the Telerik editor Sharepoint web part on my dev server justfine, but when I went to the client site, it produced a Parser Error that seemed to be coming from the Master Page.
When I looked in the Event Viewer, there was the following error:
Safe mode did not start successfully. Could not load file or assembly 'System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
The solution was found here: http://www.telerik.com/community/forums/thread/b311D-bktbdd.aspx
In my case, the AJAX controls weren't even installed to begin with. I installed v 1.0 following the instructions provided here; http://sharepoint.microsoft.com/blogs/mike/Lists/Posts/Post.aspx?ID=3 and that cleared things up.
SharePoint: Enable "Edit Page" on NewForm.aspx
Submitted by sami on Tue, 09/09/2008 - 15:01Thanks to the solution here: http://cakriwut.wordpress.com/2007/11/03/how-to-enable-edit-page-in-shar... I was able to get the "Edit Page" option to appear when adding a new list item.
I needed to do this because I wanted some Javascript to execute on that page to pre-populate some list item values. The script presented here worked great for one value. http://mdablog.spaces.live.com/blog/cns!B0C40902E1212960!473.entry
However, I have multiple querystring values, so I made a small change. (Entire code below, though.)
_spBodyOnLoadFunctionNames.push("fillDefaultValues");
function fillDefaultValues() {
var qs = location.search.substring(1, location.search.length);
var args = qs.split("&");
var vals = new Object();
for (var i=0; i < args.length; i++) {
//alert(args[i]);
var nameVal = args[i].split("=");
var temp = unescape(nameVal[1]).split('+');
nameVal[1] = temp.join(' ');
SharePoint User Cannot Create My Site
Submitted by sami on Wed, 09/03/2008 - 16:05A client recently had a problem where they were receiving 401 errors when trying to create MySites. They implemented the fix in this web post:
http://lanestechblog.blogspot.com/2008/03/401-error-when-trying-to-creat...
They deleted a users site on Friday and think this triggered the issue.
Now they cannot create a My Site for her.
The error is "There has been an error creating the personal site. Contact your site administrator for more information."
Additionally, they are unable to create any MySites and the user mentioned above receives an error when she tried to log in: “The file exists. (Exception from HRESULT: 0x80070050)"
Thanks to the solution I found here: http://meiyinglim.blogspot.com/2008/03/when-active-directory-users-get-d... it wasn't too painful. I'm copying the whole post here from that site at the end of this post.
SharePoint: Change Site Collection Administrator
Submitted by sami on Tue, 09/02/2008 - 16:21In order to do this when you do not have site collection administrator privileges, you need to go into SharePoint Central Administration.
Choose "Application Management"
Under "SharePoint Site Management" choose "Site Collection Administrators"
You can change the primary and secondary administrators from the next screen.



