<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Help writting transaction correctly in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/help-writting-transaction-correctly/m-p/11478778#M16329</link>
    <description>&lt;P&gt;Never mind changed the code back to be just a macro this seemed to clear the error.&lt;/P&gt;&lt;LI-CODE lang="general"&gt;		internal void USERNAMETOX ()
	{
	        UIDocument uidoc = this;  
        	View view = uidoc.ActiveView;&lt;/LI-CODE&gt;&lt;P&gt;This where the changes.&lt;/P&gt;</description>
    <pubDate>Wed, 12 Oct 2022 22:03:59 GMT</pubDate>
    <dc:creator>davidsUUGCH</dc:creator>
    <dc:date>2022-10-12T22:03:59Z</dc:date>
    <item>
      <title>Help writting transaction correctly</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/help-writting-transaction-correctly/m-p/11477759#M16326</link>
      <description>&lt;P&gt;The fallowing code does not compile. Gives error CS1061 which means i take means i missing something in the syntax. I have tried some stuff from this video:&amp;nbsp;&lt;A href="https://www.youtube.com/watch?v=EYdEOJ4VS8c" target="_blank" rel="noopener"&gt;https://www.youtube.com/watch?v=EYdEOJ4VS8c&lt;/A&gt; but the error does not go away. When i moved this to Visual studio 2022 it had even more errors related to start up. So i am at a loss to what is going on.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;namespace TESTMACRO6a
{
    [Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)]
    [Autodesk.Revit.DB.Macros.AddInId("DF08281E-D5FF-49E9-A1A9-E8B57F4F02C3")]
	public partial class ThisDocument
	{
		private void Module_Startup(object sender, EventArgs e)
		{

		}

		private void Module_Shutdown(object sender, EventArgs e)
		{

		}

	#region Revit Macros generated code
		private void InternalStartup()
		{
			this.Startup += new System.EventHandler(Module_Startup);
			this.Shutdown += new System.EventHandler(Module_Shutdown);
		}
		#endregion
		public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
	{
	        UIDocument uidoc = this;  
        	View view = uidoc.ActiveView;
        	
	 			//collect and set parameter. 
       			FilteredElementCollector collector = new FilteredElementCollector(uidoc.Document)
       				.OfClass(typeof(ViewSheet))
       				.WhereElementIsNotElementType();
                foreach(Element e in collector)
                {
                    foreach (Parameter p in e.Parameters)
                    {
                       if(p.Definition.Name=="CentralLocation")
                       {
                       	
                //Start transaction
                       	using (Transaction t = new Transaction(uidoc.Document,"Place family Instance"))
                       	  {
                       	    t.Start();
                //SetParameter
                            p.Set("CentralSTRG");
                            
                            t.commit();
                       }
                    }
                }     
	}}
	}
	}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help is appreciated.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Oct 2022 14:36:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/help-writting-transaction-correctly/m-p/11477759#M16326</guid>
      <dc:creator>davidsUUGCH</dc:creator>
      <dc:date>2022-10-12T14:36:12Z</dc:date>
    </item>
    <item>
      <title>Re: Help writting transaction correctly</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/help-writting-transaction-correctly/m-p/11477974#M16327</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/12979748"&gt;@davidsUUGCH&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Try replacing your 26 with&lt;/P&gt;&lt;P&gt;&lt;EM&gt;var uiapp = commandData.Application;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;var uidoc= uiapp.ActiveUIDocument;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;also try to replace line 47 with&lt;/P&gt;&lt;P&gt;&lt;EM&gt;t.Commit();&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For more information about creating your first Revit plugin kindly check the link below&lt;/P&gt;&lt;P&gt;&lt;A href="https://knowledge.autodesk.com/search-result/caas/simplecontent/content/lesson-1-the-basic-plug.html" target="_blank"&gt;https://knowledge.autodesk.com/search-result/caas/simplecontent/content/lesson-1-the-basic-plug.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Oct 2022 15:34:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/help-writting-transaction-correctly/m-p/11477974#M16327</guid>
      <dc:creator>moturi.magati.george</dc:creator>
      <dc:date>2022-10-12T15:34:40Z</dc:date>
    </item>
    <item>
      <title>Re: Help writting transaction correctly</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/help-writting-transaction-correctly/m-p/11478174#M16328</link>
      <description>&lt;P&gt;Thanks this solved the previews issue. However now it says there is an error on line 24&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;		private Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;This gives me :&lt;/P&gt;&lt;P&gt;Error CS0161: 'TESTMACRO6a.ThisDocument.Execute(Autodesk.Revit.UI.ExternalCommandData, ref string, Autodesk.Revit.DB.ElementSet)': not all code paths return a value&lt;/P&gt;</description>
      <pubDate>Wed, 12 Oct 2022 16:53:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/help-writting-transaction-correctly/m-p/11478174#M16328</guid>
      <dc:creator>davidsUUGCH</dc:creator>
      <dc:date>2022-10-12T16:53:15Z</dc:date>
    </item>
    <item>
      <title>Re: Help writting transaction correctly</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/help-writting-transaction-correctly/m-p/11478778#M16329</link>
      <description>&lt;P&gt;Never mind changed the code back to be just a macro this seemed to clear the error.&lt;/P&gt;&lt;LI-CODE lang="general"&gt;		internal void USERNAMETOX ()
	{
	        UIDocument uidoc = this;  
        	View view = uidoc.ActiveView;&lt;/LI-CODE&gt;&lt;P&gt;This where the changes.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Oct 2022 22:03:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/help-writting-transaction-correctly/m-p/11478778#M16329</guid>
      <dc:creator>davidsUUGCH</dc:creator>
      <dc:date>2022-10-12T22:03:59Z</dc:date>
    </item>
  </channel>
</rss>

