Thursday, May 28 2009 - SharePoint 2007 / Programming
First follow the steps to create a console application for working with SharePoint 2007 Social Computing features
Now that you have your application ready to go you can display users that already have a MySite using the code below.
Display Users that have a MySite
//Get the site associated with the users
using (SPSite spSite = new SPSite(@http://localhost))
{
//Create the server context because you are in a console application
ServerContext siteContext = ServerContext.GetContext(spSite);
UserProfileManager pmManager = new UserProfileManager(siteContext);
foreach (UserProfile spUser in pmManager)
{
if (spUser.PersonalSite != null)
{
using(SPSite personalSite = spUser.PersonalSite)
{
//Use SPSite like a normal site
Console.WriteLine("personalSite.Url: " + personalSite.Url);
}
}
}
}
You can see that once you have the site you could use it to check document libraries or any other action you would perform on an SPSite.
Addition Resources
For an in-depth look at the API and programmatically using the Social Computing features of SharePoint 2007 check out chapter 8 of Professional SharePoint 2007 Development
Thursday, May 28 2009 - SharePoint 2007 / Programming
When using MySites it is good to know that MySites are created on an as needed basis, this is to save disk space and resources. There are times when you might want to create a number of MySites before users go to them the first time. We will look at how to do that using C# code and the SharePoint object model.
NOTE: This console application assumes you have the correct permissions such as an administrator and is running on a machine that has the SharePoint object model.
Create Console Application to host MySite Code
To automatically create users MySites ahead of time using the SharePoint object model you can simply create a console application.
- Click File->New->Project, then select Console Application from the list of templates.
- Next add a reference to the following assemblies
- Microsoft.SharePoint
- Microsoft.Office.Server
Add MySite C# Code
Now that you have your application to run the code, you will use two major objects
- Microsoft.Office.Server.UserProfiles.UserProfile – namely you will use the method CreatePersonalSite().
- Microsoft.Office.Server.UserProfiles.UserProfileManager – this object is used to get each user.
The code to create the sites is as follows, just add it to your console application and make changes as needed.
//Get the site associated with the users
using (SPSite spSite = new SPSite(@http://localhost))
{
//Create the server context because you are in a console application
ServerContext siteContext = ServerContext.GetContext(spSite);
UserProfileManager pmManager = new UserProfileManager(siteContext);
//Loop through all of the users to create sites for
string strUserName = "devcow\\brendon";
if (pmManager.UserExists(strUserName))
{
UserProfile spUser = pmManager.GetUserProfile(strUserName);
if (spUser.PersonalSite == null)
{
Console.WriteLine("This may take a few minutes...");
spUser.CreatePersonalSite();
}
}
}
Addition Resources
For an in-depth look at the API and programmatically using the Social Computing features of SharePoint 2007 check out chapter 8 of Professional SharePoint 2007 Development
Wednesday, May 20 2009 - SharePoint 2007 / Set up
I have seen this as a common problem that MySite and MyLinks don’t show up on a portal. Let’s take a quick look at why they may not be showing up.
Step 1 – Try to look at configuration
The first step is checking to make sure the Shared Service Provider is set up.
To do this:
- Go to http://centraladmin.devcow.loc/_admin/managessp.aspx
- Make sure that the Portal is listed under the Shared Service you have set up with MySites
- Next confirm that the settings of the Shared Service Provider are correct, this will be the web application and the MySite Location Url as well as any permission accounts.
- Once you have checked the Shared Service, check inside of the Shared Service under Personalization services permissions that NT AUTHORITY\Authenticated Users has both Personal Features, Personal Site rights.
Step 2 – Understand the Link controls and locations better
If none of that works, there could be a permission issue or a problem deploying the MySite features.
Let’s look at what the links actually are on the page and how they show up and don’t show up.
You might have guessed they are just delegate controls! So there you have 2 of the at least 3 delegate controls on the page. Check this reference out SharePoint Delegate Controls in SharePoint 2007 - Best Practices.
The MySiteFeatureElements.xml file simply has 3 delegate controls that are turned on and provide the link functionality needed.
<Control Id="GlobalSiteLink1" Sequence="100" ControlSrc="~/_controltemplates/mysitelink.ascx" />
<Control Id="GlobalSiteLink2" Sequence="100" ControlSrc="~/_controltemplates/mylinks.ascx"/>
<Control Id="ProfileRedirection" Sequence="100" ControlSrc="~/_controltemplates/mysiteredirection.ascx"/>
Step 3 – Check that the MySite Feature is Activated
If you still don’t see the MySite link make sure that this feature is activated. To do this you can download the stsadm commands from Gary Enumerate Features. Then simply run this command with your central administration website and validate that the feature with Title My Site (the GUID is 69CC9662-D373-47fc-9449-F18D11FF732C) is activated.
Mine looked like this from the stsadm command
stsadm -o gl-enumfeatures -url http://centraladmin.devcow.loc -showhidden
71. MySite: My Site (Farm - Active)
Step 4 – Come up with other ideas or try any other option
If that still doesn’t work it could be permission issues with the users or with a connection to your Shared Service provider.
Also you can try connecting the site to a portal location, check out this blog entry
Set up SharePoint sites with user profiles and SSP correctly
Wednesday, April 15 2009 - SharePoint 2010
Thursday, April 02 2009 - SharePoint 2007
Monday, March 16 2009 - General
As much as I love the social tools that have been built over the last few years they do not replace the need to actually do in person networking. I have found that some of my friends over the last 9 months have had to look for jobs. Many of these people I never thought would be in that position, but it turns out they were.
When I first talk to someone that is looking for a job there are few bits of advice I ask them to do before I can do much to help them.
First I ask them to fill out two profiles online. Linked.com and VisualCV.com. I bet you are wondering why I do that. The reason is that both of these profiles help promote yourself and helps you network. Make sure you let people know what the links to these profiles are in your resume, they aren’t going to find them on their own! Also pick profile names that are easy to remember like your name.
- Linkedin.com - allows you to put your resume online and connect with other people that you have worked with in the past. This gives a potential company a way to see if anyone recommends you, what you job history is like and lets them find you. If you let them find you and they are interested they are more willing to talk to you when they reach out to you.
- VisualCV.com – this might seem like something not needed, but this is a critical step in getting into the job search. It provides a number of valuable results if done right. The obvious result is that it provides a nice looking resume that is better than 90% of the word only ones out there. If you can get a company to look at it and the content is good you will probably get a call. The other thing it does, is make you think about your positive skills and accomplishments. It is very hard to get it right the first time and will take a good bit of time if done right.
Next you should make a list of what type of job you want. This would be jobs like Consulting, Small Business, Medium Business, Enterprise. All of these different types of companies have needs, but you need to figure out what type of company fits your life/work style. If you get it right you will love your job and work much harder.
Once you have selected your type of job, pick 5 companies that you would like to work for. Go to their site and make sure you know about them. Submit your resume directly to them on their site and follow up with them if that option is available.
Lastly get out and network with people. When you are out ask them if they mind connecting with you on Linkedin.com. This is your critical first step in them really looking at you and reviewing who you are so make sure it looks good. Online tools have made it easy to sit back and not work as hard on our networking, but meeting someone in person will be much better than just trying to connect online. Go to meetings on topics that are similar in interest to what you are doing and find the local community in the area for what you do. Remember that the online tools are just tools, use them wisely and correctly and they will improve and help your life. Use them poorly and the results will be the same.
Wednesday, February 04 2009 - Social Computing / Mashup
I would have released this earlier but I was only able to give it a little bit of attention at night. I have been tremendously busy working on a new Enterprise Search Engine for Community Server. Both cool projects, both tons of fun to work on, but work comes first.
This Mashup Framework is meant as Enterprise option to Microsoft Popfly and uses the same schema as the Popfly blocks you have already written. The differences are very small and only require that you write your code in .NET. With this framework you have control over the code, where it runs and the security of the blocks that request information.
This Mashup Framework is built for enabling Enterprise Mashups that build on .NET applications. This simple framework allows you to add a few lines of code to and load configuration elements to build your mashup.
Currently the items available with this download are:
- The Mashup Framework in DevCow.Mashup.dll
- A set of SampleBlocks and Config files to show some very simple possibilities.
- Two applications for testing the Framework
There are many other items I hope to add to the framework. For now the Sample blocks, sample applications and code for both can be found on CodePlex.
http://www.codeplex.com/mashup
If you have ideas for more Mashup Blocks join the site or write your own. I will have examples on how easy it is to write your own block soon.
I bet that you want to see what the Framework looks like and how you would write your own blocks. Here is a bit of sample code on how to run in a console application.
MashupManager mm = new MashupManager();
//Get the blocks from the mashup manager
MashupBlock bi1 = mm.GetBlock("NameDateArrayBlock2");
MashupBlock bi2 = mm.GetBlock("BirthdayBlock");
//Create a new mashup
Mashup myMashup = new Mashup();
//add a mashup connection
MashupBlockConnection conn = myMashup.AddConnection(bi1, "MyArray").AddConnection(bi2, "Birthday");
//Map the inputs to the correct parameters
conn.mappers.Add("date", new BlockMapper { Source = "NameDateArrayBlock2", Value = "Birthdate" });
conn.mappers.Add("name", new BlockMapper { Source = "NameDateArrayBlock2", Value = "FirstName" });
//execute the mashup
myMashup.output = Console.out;
myMashup.ExecuteMashup();
Friday, November 28 2008 - General
Wednesday, November 26 2008 - Cloud Services / DataServices
Thursday, November 20 2008 - Social Computing