SharePoint Web Part Debugging
Posted: 20/01/2012 Filed under: SharePoint, Visual Studio | Tags: Debugging, Web Part Leave a comment »NOTE: This applies to going through the steps manually using Visual Studio 2010. And the issue in concern, is breakpoints not being hit.
Debugging web parts in SharePoint are not difficult, but they can be annoying. This article on MSDN, (albeit an old one) describes how this can be achieved.
Essentially, ensure that the web part assembly is part of your web.config safe control list. Then, from Visual Studio, select Debug –> Attach to Process. This is where you will need to select the application pool IIS Process, which will be w3wp.exe.
Now you can set your breakpoint and begin debugging….right? Well not exactly, chances are you will run into a problem in which, the breakpoint will currently not be hit.
This is because we are trusting Visual Studio 2010 to determine the type of code being debugged. We’ll have to change this, by selecting Debug –> Attach to Process, then under Attach To, click Select.
Note the option, Automatically determine the type of code to debug
Click and Select Debug these code types option. The tick and select Managed (v2.0, v1.1, v1.0), click on OK, then attach the w3wp.exe process.
Now set you breakpoint and begin debugging your web part. The issue of not hitting a breakpoint will not occur again.
SPField Determining a Field Type
Posted: 12/12/2011 Filed under: SharePoint | Tags: Programming, SPField Leave a comment »What if you needed to find all “People or Group” field from a particular list? The code snippet below shows you how easily.
1: using (SPSite oSite = new SPSite("http://mysitecollection"))
2: {
3: using (SPWeb oWeb = oSite.AllWebs["myweb"])
4: {
5: SPList oList = oWeb.Lists["mylist"];
6:
7: foreach (SPField oField in oList.Fields)
8: {
9: if (oField.TypeDisplayName.ToString() == "Person or Group")
10: {
11: Console.WriteLine(oField.Title);
12: Console.WriteLine();
13: }
14: }
15: }
16: }
Note the bit where I used the TypeDisplayName property, this is where I specify the field type I want, and in this case it’s “People or Group”. If I wanted the “Date and Time” field, I’ll just specify “Date and Time”.
How do I get these values? When you create a new column they are listed under Name and Type.
Hope this helps.
Moving Configdb, a four step process.
Posted: 21/03/2010 Filed under: Configuration, SharePoint, SQL Server | Tags: Configuration, SQL Server Leave a comment »Note: It is strongly recommended that you read the available literature on TechNet regarding moving SharePoint database prior to performing the move.
Step 1: From the Central Administration interface, remove the SharePoint server. Run psconfig with the disconnect switch.
Step 2: Copy the database .mdf and .ldf files to the new database.
Step 3: Run psconfig with the connect switch.
Step 4: Run SharePoint Config wizard.
All done
SharePoint and IE Prompts
Posted: 24/02/2010 Filed under: Configuration, SharePoint | Tags: Configuration Leave a comment »There are times when you keep getting prompted by Internet Explorer every time you navigate to a new page/list/library/site (you get the picture). Listed below are a few things to try out:
- Enter in you credential and password, tick and select remember me and click OK.
- If the above has not helped then, on Internet Explorer under Security, add SharePoint to your Trusted Sites.
- If the above two has not helped and you keep getting prompted, move to your SharePoint application and web front end server. From Control Panel, go to User Accounts and on Advanced, remove the SharePoint credentials from the Password list.
Hope one of the 3 listed above will help you with the annoying prompts.
stsadm Access Denied Error
Posted: 02/02/2010 Filed under: SharePoint | Tags: Configuration 2 Comments »This is probably because you have User Access Control (UAC) turned on. Turn it off, via-Control Panel and you would not have the problem anymore.
Updating your Top-Link Bar
Posted: 04/11/2009 Filed under: Configuration, SharePoint Leave a comment »Do not make the mistake of thinking that by changing your Web Title under Site Settings, your top-link bar will be changed as well.
In order to update your top link bar you would have to get into the Top Link Bar settings page from Site Settings, select the web to be updated and change the description field there.
Almost got caught out by SP2
Posted: 07/08/2009 Filed under: SharePoint | Tags: Configuration Leave a comment »I decided to make life easy for myself and streamlined my SharePoint install with SP2 and other updates. A process that is easily achieved, later I created a SharePoint environment using the streamlined install. Also easily achieved, but this is where I should have remembered about the bug in where SP resets the SharePoint to a trial version. Very annoyed with myself for forgetting this.
Just today I as I was poking around in Central Administration, I discovered this under Application –> Check Services Enabled in this Farm:
Thankfully, I had the product license key nearby. To rectify:
1) Central Administration –> Operations –> Convert License Type
2) Enter in the product key and click OK
3) All complete
Not going to get caught out again, that’s for sure
Calendar Start Day?
Posted: 18/05/2009 Filed under: SharePoint | Tags: Configuration Leave a comment »We can easily specify a start day to be different from Sunday. Unfortunately, it’s not done through views. It is done on a site-by-site basis through Site Settings.
For example, on the Site Settings page under the Site Administration section click Regional Settings. Under the Define Your Work Week options, pick and select Monday as the First day of week and click OK. Now if we browse into our calendars we’ll have Monday as our Start Day.
Checkin Multiple Documents
Posted: 12/05/2009 Filed under: SharePoint | Tags: Configuration, Development 1 Comment »We all probably already know that with SharePoint server we can do this via-Site Actions –> Manage Content and Structure. From there we can navigate to a particular library, tick and select all checked-out items and then click Actions –> Check In.
Unfortunately, as stated this is only available on SharePoint server and not SharePoint Services. We can however, programmatically checkin documents within SharePoint services. Below is a sample code snippet performing checkin for documents that are checked out. Hope this helps.
MS Word Gotcha
Posted: 11/05/2009 Filed under: SharePoint Leave a comment »Creating a MS Word document by right-clicking New –> Microsoft Office Word Document actually creates the file as 0 bytes in size! Note, this very same action with MS Excel or MS PowerPoint creates files that are about 9KB or so.
Now, this does not really mean much until we actually try to Upload the file into a particular document library. If the file is 0 bytes in size, we would get an error (this happens with Notepad files as well).
And creating a document by opening up MS Word Application and saving it completely blank however, saves the file as 9.60KB in size. Not really sure why the difference in size for the two separate actions. Just something to keep an eye out for.