{"id":3383,"date":"2006-09-18T23:33:53","date_gmt":"2006-09-18T23:33:53","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/buckh\/2006\/09\/18\/vc-api-checkin-may-return-0\/"},"modified":"2006-09-18T23:33:53","modified_gmt":"2006-09-18T23:33:53","slug":"vc-api-checkin-may-return-0","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/buckh\/vc-api-checkin-may-return-0\/","title":{"rendered":"VC API: CheckIn() may return 0"},"content":{"rendered":"<p>Back in March, I wrote a post called <a href=\"http:\/\/blogs.msdn.com\/buckh\/archive\/2006\/03\/20\/checkin.aspx\">How to check in changes on behalf of other users<\/a>.&nbsp;&nbsp;Among other things, you&#8217;ll find the documentation comments for the <a href=\"http:\/\/msdn2.microsoft.com\/en-us\/library\/microsoft.teamfoundation.versioncontrol.client.workspace.aspx\">Workspace<\/a>.<a href=\"http:\/\/msdn2.microsoft.com\/en-us\/library\/microsoft.teamfoundation.versioncontrol.client.workspace.checkin.aspx\">CheckIn()<\/a> method, which you&#8217;ll notice is now on MSDN.&nbsp; While that and <a href=\"http:\/\/blogs.msdn.com\/buckh\/archive\/2006\/03\/20\/evaluate_checkin.aspx\">How to validate check-in policies, evaluate check-in notes, and check for conflicts<\/a> are probably the best documentation on how to use CheckIn(), I didn&#8217;t mention that CheckIn(), which returns the changeset created by checking in, may return 0.<\/p>\n<p>The version control server automatically undoes the pending changes in the case where you attempt to check in files that haven&#8217;t changed rather than create new versions of them.&nbsp; In the extreme case, CheckIn() will return 0 when all of the changes being checked in are edits without content changes or locks.&nbsp; Nothing bad happened, but the server did not create a changeset.&nbsp; If something bad happened, such as having one or more conflicts, CheckIn() will throw an exception.<\/p>\n<p>The <a href=\"http:\/\/msdn2.microsoft.com\/en-us\/library\/microsoft.teamfoundation.versioncontrol.client.commitcheckineventargs_properties.aspx\">CommitCheckinEventArgs object<\/a>, available&nbsp;by listening to&nbsp;the VersionControlServer object&#8217;s <a href=\"http:\/\/msdn2.microsoft.com\/en-us\/library\/microsoft.teamfoundation.versioncontrol.client.versioncontrolserver.commitcheckin.aspx\">CommitCheckin event<\/a>, contains the list of files that were actually checked in (<a href=\"http:\/\/msdn2.microsoft.com\/en-us\/library\/microsoft.teamfoundation.versioncontrol.client.commitcheckineventargs.changes.aspx\">Changes<\/a>)&nbsp;and the files that were undone (<a href=\"http:\/\/msdn2.microsoft.com\/en-us\/library\/microsoft.teamfoundation.versioncontrol.client.commitcheckineventargs.undonechanges.aspx\">UndoneChanges<\/a>).<\/p>\n<p>tags: <a href=\"http:\/\/technorati.com\/tag\/tfs\" rel=\"tag\">tfs<\/a>, <a href=\"http:\/\/technorati.com\/tag\/team+foundation+server\" rel=\"tag\">team foundation server<\/a>, <a href=\"http:\/\/technorati.com\/tag\/tfs+api\" rel=\"tag\">tfs api<\/a>, <a href=\"http:\/\/technorati.com\/tag\/source+control\" rel=\"tag\">source control<\/a><\/p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Back in March, I wrote a post called How to check in changes on behalf of other users.&nbsp;&nbsp;Among other things, you&#8217;ll find the documentation comments for the Workspace.CheckIn() method, which you&#8217;ll notice is now on MSDN.&nbsp; While that and How to validate check-in policies, evaluate check-in notes, and check for conflicts are probably the best [&hellip;]<\/p>\n","protected":false},"author":94,"featured_media":10268,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[6,8,15],"class_list":["post-3383","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized","tag-source-control","tag-team-foundation","tag-tfs-api"],"acf":[],"blog_post_summary":"<p>Back in March, I wrote a post called How to check in changes on behalf of other users.&nbsp;&nbsp;Among other things, you&#8217;ll find the documentation comments for the Workspace.CheckIn() method, which you&#8217;ll notice is now on MSDN.&nbsp; While that and How to validate check-in policies, evaluate check-in notes, and check for conflicts are probably the best [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/buckh\/wp-json\/wp\/v2\/posts\/3383","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/buckh\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/buckh\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/buckh\/wp-json\/wp\/v2\/users\/94"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/buckh\/wp-json\/wp\/v2\/comments?post=3383"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/buckh\/wp-json\/wp\/v2\/posts\/3383\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/buckh\/wp-json\/wp\/v2\/media\/10268"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/buckh\/wp-json\/wp\/v2\/media?parent=3383"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/buckh\/wp-json\/wp\/v2\/categories?post=3383"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/buckh\/wp-json\/wp\/v2\/tags?post=3383"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}