Archive for August, 2012

TFS Branching Guide


No Comments

Team Foundation Server

There are few useful features to keep control the source code, following are few methods may be used in different scenario.

For example, when the project is under construction, while the current production version of the project is required to bug fix, there are few approaches to cater the needs,

1. Multiple workspace with labeling different versions of source code

– The workspace acts as the local working folder. By creating creating 2 different workspaces, one can contain the version under construction (e.g. v2.0), and get back the historical version which is labeled before (e.g. v1.0).

– Once the bug is fixed (v1.1), then check-in back the changed source code to TFS, added back to v2.0 or create a new label called v2.1

This is useful for small team development, while only one to two developers will fix the bug within limited time period.


2. Branching

– Create another branched version at the same time

– Both version is actually kept track in TFS (server side) instead of client side mentioned above (workspace)

– The branched version have to be merged to mainstream version after completion

This supports many developers working on the branched version and the main version at the same time.


3. Shelves

– Shelve acts as a temp location in TFS for putting existing incomplete changes

– By putting the changes into the shelves, the file is “undo” to previous version, for testing or developing another feature


No Comments

Error when you try to edit the content source schedule in Microsoft Office SharePoint Server 2007: “Access is denied”

To work around this issue, you must add the WSS_WPG group to the Tasks folder. To do this, follow these steps:

  1. Use an account that has administrative permissions to log on to the computer that is running the Office SharePoint Server 2007 indexing service.
  2. Click Start, click Run, type cmd, and then click OK.
  3. At the command prompt, type the following command, and then press ENTER:attrib –s %windir%\tasks

    Note In this example, %windir% is the path of the Windows folder. For example, the path can be C:\Windows.

    Note If Windows Explorer is open when you make this change, you will not see the extra tab in Windows Explorer. If Windows Explorer is already open, close and then reopen it before you perform step 4.

  4. In Windows Explorer, right-click the Tasks folder, and then click Properties.
  5. In the Tasks Properties dialog box, click the Security tab, and then click Add
  6. In the Select Users, Computers, or Groups dialog box, type WSS_WPG in the Enter object names to select box, and then click OK.
  7. Grant the following permissions for the WSS_WPG account, and then click OK:
    • Read
    • Write
  8. Click Start, point to Administrative Tools, and then click Internet Information Services (IIS) Manager.
  9. In Internet Information Services (IIS) Manager, right-click ComputerName (local computer), click All Tasks, and then click Restart IIS.
  10. Click Start, click Run, type cmd, and then click OK.
  11. At the command prompt, type the following command, and then press ENTER:attrib +s %windir%\tasks

    Note This resets the Tasks Property back to the default view.

No Comments

Get Email Address from AD for Different Trusted Domains

public string GetADEmailAddress(string adFullUserName)
	if (!adFullUserName.Contains(@"\"))
		return string.Empty;

	// init var
	string domain = adFullUserName.Contains(@"\") ? adFullUserName.Substring(0, adFullUserName.IndexOf(@"\")) : null;
	string adusername = adFullUserName.Contains(@"\") ? adFullUserName.Substring(adFullUserName.IndexOf(@"\") + 1) : "";
	string adConnectionStringWithDomain = adConnectionString + "/CN=" + domain;

	DirectoryEntry entry = new DirectoryEntry("LDAP://" + domain);
	DirectorySearcher dSearch = new DirectorySearcher(entry);
	dSearch.Filter = "(&(objectClass=user)(samAccountName=" + adusername + "))";

	SearchResult r = dSearch.FindOne();
	if (r != null)
		DirectoryEntry UserDirectoryEntry = r.GetDirectoryEntry();
		return UserDirectoryEntry.Properties["mail"].Value.ToString();

	return string.Empty;

No Comments