Quantcast
Channel: Forums - ArcObjects SDKs
Viewing all articles
Browse latest Browse all 1374

Error when using ServerStyleGalleryClass ?

$
0
0
Hi,

First, I used:

IStyleGallery styleGallery = new StyleGalleryClass();

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.
So, I used ServerStyleGalleryClass, and I used "MakeServerStyleSet" utility to convert my style file into server style.

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)
Code:

          IStyleGallery styleGallery = new ServerStyleGalleryClass();

            IStyleGalleryStorage styleStor = (IStyleGalleryStorage)styleGallery;           
            string startupPath = Environment.CurrentDirectory;


            string strFilePath = startupPath + "\\Data\\Styles\\SoDo.ServerStyle";
            styleStor.AddFile(strFilePath);
           
            IEnumStyleGalleryItem styleItems;           
         
            styleItems = styleGallery.get_Items("Line Symbols", strFilePath, "Default");  // Return NULL value
            styleItems.Reset();
            IStyleGalleryItem styleGalleryItem = styleItems.Next();

Are there anyone know what's wrong ?

Thanks and regards,

Tai

Viewing all articles
Browse latest Browse all 1374

Trending Articles