<?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: Error when using ServerStyleGalleryClass ? in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/error-when-using-serverstylegalleryclass/m-p/133261#M3458</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I know that this is stating the obvious but perhaps the server style file which was generated does not contain the thing that you are asking for.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The help reads:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;"The style items from the specified style file, in the specified class and category. The style set and category may be blank to return all items"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Modify your code to get everything thing and see if that works.&amp;nbsp; If it does then print out what you get.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 22 Aug 2013 11:44:14 GMT</pubDate>
    <dc:creator>RichardWatson</dc:creator>
    <dc:date>2013-08-22T11:44:14Z</dc:date>
    <item>
      <title>Error when using ServerStyleGalleryClass ?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/error-when-using-serverstylegalleryclass/m-p/133260#M3457</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;First, I used:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;IStyleGallery styleGallery = new StyleGalleryClass();&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I can run my program without error (on my computer). But this require using ESRI.ArcGIS.Framework (need install Arcgis Desktop). And, I can't use for my client computers.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;So, I used ServerStyleGalleryClass, and I used "MakeServerStyleSet" utility to convert my style file into server style.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Then, I used below codes, but I got the error "Error HRESUT _EFAIL has been returned from a call to a COM component" (because after getting Items, styleItems is NULL)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;PRE class="plain" name="code"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IStyleGallery styleGallery = new ServerStyleGalleryClass();&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IStyleGalleryStorage styleStor = (IStyleGalleryStorage)styleGallery;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string startupPath = Environment.CurrentDirectory;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string strFilePath = startupPath + "\\Data\\Styles\\SoDo.ServerStyle"; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; styleStor.AddFile(strFilePath); &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IEnumStyleGalleryItem styleItems;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; styleItems = styleGallery.get_Items("Line Symbols", strFilePath, "Default");&amp;nbsp; // Return NULL value &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; styleItems.Reset(); &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IStyleGalleryItem styleGalleryItem = styleItems.Next();&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Are there anyone know what's wrong ?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks and regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Tai&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Aug 2013 09:13:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/error-when-using-serverstylegalleryclass/m-p/133260#M3457</guid>
      <dc:creator>TaiBui</dc:creator>
      <dc:date>2013-08-22T09:13:00Z</dc:date>
    </item>
    <item>
      <title>Re: Error when using ServerStyleGalleryClass ?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/error-when-using-serverstylegalleryclass/m-p/133261#M3458</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I know that this is stating the obvious but perhaps the server style file which was generated does not contain the thing that you are asking for.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The help reads:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;"The style items from the specified style file, in the specified class and category. The style set and category may be blank to return all items"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Modify your code to get everything thing and see if that works.&amp;nbsp; If it does then print out what you get.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Aug 2013 11:44:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/error-when-using-serverstylegalleryclass/m-p/133261#M3458</guid>
      <dc:creator>RichardWatson</dc:creator>
      <dc:date>2013-08-22T11:44:14Z</dc:date>
    </item>
    <item>
      <title>Re: Error when using ServerStyleGalleryClass ?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/error-when-using-serverstylegalleryclass/m-p/133262#M3459</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;I know that this is stating the obvious but perhaps the server style file which was generated does not contain the thing that you are asking for.&amp;nbsp; &lt;BR /&gt;&lt;BR /&gt;The help reads:&lt;BR /&gt;&lt;BR /&gt;"The style items from the specified style file, in the specified class and category. The style set and category may be blank to return all items"&lt;BR /&gt;&lt;BR /&gt;Modify your code to get everything thing and see if that works.&amp;nbsp; If it does then print out what you get.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you. I discovered that, we need to release COM object, and I added below codes&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;if (styleItems != null) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Runtime.InteropServices.Marshal.ReleaseComObject(styleItems);&amp;nbsp; &lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; before the line&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;styleItems = styleGallery.get_Items("Line Symbols", strFilePath,"");&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;, then successfull:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Kind regards,&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Aug 2013 00:19:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/error-when-using-serverstylegalleryclass/m-p/133262#M3459</guid>
      <dc:creator>TaiBui</dc:creator>
      <dc:date>2013-08-23T00:19:52Z</dc:date>
    </item>
  </channel>
</rss>

