Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9195243
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T21:35:13+00:00 2026-06-17T21:35:13+00:00

I like to checkout a file trough C# code, but I always get a

  • 0

I like to checkout a file trough C# code, but I always get a TF14098 Acess Denied Exception. The TFS Administrator reassures, that I have checkout/edit permissions and in VisualStudio and with tf.exe I do not have any problems to checkout the file.

This is my current C# code:

            const string tfsServer = @"http://MyServer:8080/tfs";
        const string fileName = @"$/MyFile.xaml";
        const string workspaceName = "MyWorkspace";

        using (TfsTeamProjectCollection tfs = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri(tfsServer)))        
        {               
            if (tfs != null)
            {
                WorkspaceInfo workspaceInfo = Workstation.Current.GetLocalWorkspaceInfo(fileName);
                if (null != workspaceInfo)
                {
                    var vcs = tfs.GetService<VersionControlServer>();   
                    Workspace workspace = workspaceInfo.GetWorkspace(tfs);                                  
                    if(workspace == null){

                        workspace = vcs.GetWorkspace(workspaceName, vcs.AuthorizedUser);
                    }                   

                    vcs.NonFatalError +=    VersionControlOnNonFatalError;
                    vcs.Getting += OnGetting;
                    vcs.BeforeCheckinPendingChange += OnBeforeCheckinPendingChange;
                    vcs.NewPendingChange += OnNewPendingChange;

                    if (workspace != null)
                    {
                        workspace.PendEdit(fileName);
                    }                       
                }
            }
        }

It results always with:

Non-fatal failure: TF14098: Access Denied: User Me needs PendChange permission(s) for $/MyFile.xaml.

After a lot of research for this error I tryed to check the permissions trough Dos-Box and I did the following commandline:

tf checkout $/MyFile.xaml

it results in a Checkout of the file without any problem! (If I am in the directory where the file resists)

Has anyone a Idea what the problem may be? What’s the difference between my code (my Application written and executed with VisualStudio2012) and the commandline tf checkout?

Thanks for tips and hints!
Patrik

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T21:35:15+00:00Added an answer on June 17, 2026 at 9:35 pm

    The problem in your code is, that the TfsTeamProjectCollection does not fit to your path, because you never set the Collection name (should be something like @”http://MyServer:8080/tfs/DefaultCollection”).
    I never did a checkout by using the API, but I did a checkin starting like this:

    WorkspaceInfo wi = Workstation.Current.GetLocalWorkspaceInfo(Environment.CurrentDirectory);
    TfsTeamProjectCollection tfs = new TfsTeamProjectCollection(wi.ServerUri);
    
    VersionControlServer versionControlServer = (VersionControlServer)tfs.GetService(typeof(VersionControlServer));
    Workspace workSpace = versionControlServer.GetWorkspace(wi);
    

    As you can see, I search the TeamCollection by using my workspace and not setting it independent. Doing it this way, you will get the right VersionControlServer to do your checkout.

    The difference by using the tf.exe tool is, that you run it in your local workspace, so the tool knows to which item it is linked in TFS and to which Collection.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to checkout a single file from a remote git-repository. Is there
Does a feature like TFS auto-checkout before checkin exist, so that I don't checkout
I'd like to automatically checkout a file when I start to edit it in
I am using Google Checkout and I could like to create an absolute URL
There are some products for which I would like to have a special checkout
Like a person asked here (but his solutions as to call a nother function)
Seems like this should be super-simple but looking around for a simple (or half-way
The company that I'm working is working with SVN but I would like to
I would like to use Subversion and checkout only source files (for example: checking
I'm using SVNKit to get the contents of a file from our repository. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.