Friday, March 9, 2012

Your solution file isn't being displayed in the Visual Studio 2010 Solution Explorer

In it's default state, Visual Studio 2010 isn't configured to display the solution in the Solution Explorer window.  If you wish to change the configuration to always display the solution, you can do so via the following steps:
  1. Open Visual Studio 2010
  2. Click on Tools -> Options
  3. Expand the Project and Solutions node
  4. Click on General
  5. Place a check in the Always Show Solution checkbox
  6. Click OK

Thursday, March 8, 2012

Obtain a list of users who haven't uploaded a picture in their SharePoint 2010 User Profile

In the event that your HR team would like to "bust" all individuals who haven't uploaded a picture in their user profile, here is a simple SQL query that you can run against the SharePoint 2010 User Profile content database that will provide them with a name and email address of the "offending" users:

SELECT
[UserProfile_Full].PreferredName,
[UserProfile_Full].Email
FROM [User Profile Service Application_ProfileDB].[dbo].[UserProfile_Full]
WHERE PictureUrl IS NULL

NOTE: You may need to modify the database name. If your SharePoint Admin used the default farm setup process, a GUID will be tagged to the database name.

Wednesday, March 7, 2012

Simple Redirect Web Part

If you need a quick solution for redirecting users from one SharePoint page to another, here is a very simple solution:

  1. Open your browser to the page of your SharePoint site which you'd like to place the redirect on
  2. Click on Site Actions -> Edit Page
  3. Locate the Bottom Zone and click Add a Web Part
  4. Under Categories, select Media and Content
  5. Under Web Parts, select Content Editor
  6. Click the Add button
  7. Locate the newly added web part and click on the dropdown arrow in the upper right hand corner
  8. Select the Edit Web Part option
  9. Under Layout, place a check in the Hidden checkbox
  10. In the Content Editor web part, click on the link that reads Click here to add new content link
  11. In the Format Text ribbon, click on the HTML button and select Edit HTML Source
  12. In the HTML Source dialog, enter the following HTML:
    <meta http-equiv="refresh" content="0;url=http://TargetSite/TargetPage.aspx">
  13. Click OK
  14. Click OK
When you no longer need the redirect web part, you can remove it from your page as follows:

  1. Open your browser, type in the address to the page of your SharePoint site on which you placed the redirect web part, and append "&contents=1" to it (i.e. http://SourceSite/SourcePage.aspx?contents=1)
  2. Place a check in the checkbox next to the redirect content editor web part you created above
  3. Click Delete to remove the redirect content editor web part

Wednesday, February 29, 2012

How to Logout Remote Desktop Users

If you frequently encouter issues in which multiple developers like to "camp-out" in your development environments (i.e. they simply close their remote desktop sessions as opposed to logging out), here are some simple steps you can use to free up those idle sessions:
  1. Click Start -> Run...
  2. Type in "mstsc /admin"
  3. Click OK
  4. When the Remote Desktop Connection dialog appears, enter the server name or IP of the server you wish to log onto in the Computer textbox/dropdown
  5. Log on to server
Now that you're in, you can see exactly who is tieing up the resources as well as how long they've been idle via the following steps:
  1. Open a command prompt
  2. Type "quser" and hit Enter to obtain a list displayed as follows:
The best option for freeing up one of those sessions is to talk to the individuals and have one or both of them logout out their sessions themselves (i.e. you never know, they might actually have some important work in progress!); however, if you absolutely need to free up a session, you can do so via the following steps:
  
  1. Open a command prompt
  2. Type "loggoff sessionID" (i.e. "logoff 1" if I wanted to give rsufit the boot since he's been hogging a session for the past 10 days) and hit Enter
You're now free to logout of your Admin session and log into the Remote Desktop session as you normally would.

Tuesday, February 28, 2012

SQL Transaction Template

Here is a transaction template that could come in handy any time you need to link a couple of related SQL operations together:

BEGIN TRANSACTION
BEGIN TRY

 --Add related SQL operations here

 IF @@TRANCOUNT > 0
  COMMIT TRANSACTION

END TRY
BEGIN CATCH
 SELECT ERROR_MESSAGE() AS ErrorMessage;
 IF @@TRANCOUNT > 0
  ROLLBACK TRANSACTION;
END CATCH

Friday, February 24, 2012

Overview of leveraging Word Services in SharePoint 2010

I found a nice overview of leveraging Word Services in SharePoint 2010 for automated document creation/conversion processes and thought I'd share. I can already envision at least 50 things I'd like to use this for. Perhaps it will inspire you as well!

http://msdn.microsoft.com/en-us/Office2010DeveloperTrainingCourse_DevelopingWithWordServices

Monday, January 9, 2012

Possible solution for your AJAX AutoCompleteExtender not working

I just ran across an issue in which I couldn't get the AJAX AutoCompleteExtender control to respond when I entered text into the target textbox control. The solution in my case was to uncomment the reference to System.Web.Script.Services.ScriptService in my web service code as follows:

[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
[System.Web.Script.Services.ScriptService]
public class MySampleWS : System.Web.Services.WebService

To make a long story short, I spent quite a while tweaking the ASP .NET side when the problem was actually in my web service code. Anyway, once I opened up the web service code again and noticed that commented section, I had the problem solved in seconds. Hopefully, this may prove useful to you as well!