Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Gettting the stream an app is published to .net SDK

Hi Guys

I am working with the .net SDK building a set of administration utils.

I am currently trying to find the stream of an application to do this I use

appIdentifier.Meta.Get<string>("stream");

I have tried this iterating through all apps in a collection and on specific apps that I know are published.

The above code always returns an empty string.

Is there another way to find the stream of an app via the sdk?

1 Solution

Accepted Solutions
Øystein_Kolsrud
Employee
Employee

You can always access it as an instance of the AbstractStructure Class. Then you could do something like this:

var streamName = myprop.Get<AbstractStructure>("stream").Get<string>("name");

View solution in original post

10 Replies
Alexander_Thor
Employee
Employee

Excuse my lack of knowledge on the .Net SDK but the underlying Engine API method that would return this is GetAppProperties on the App class. It should be a full dynamic property named stream that contains the id and full-text name of the stream.

Now I'm just taking a guess and thinking that this method in the SDK should map to the same Engine API method

App.GetAppProperties Method

konrad_mattheis
Luminary Alumni
Luminary Alumni

Hi Simon,

the stream is not a string, see:

"stream": {
   "id": "a70ca8a5-1d59-4cc9-b5fa-6e207978dcaf",
   "name": "Monitoring apps"
   },

So you can not fetch it width Get<string>("stream");, you have to define a structure with (id & name) and than you can fetch it.

bye Konrad

Not applicable
Author

Thanks guys I think you have set me in the correct direction.

I have created a Type BIStream that inherits Qlik.Engine.AbstractStructure

I have defined the type like so

  public string id

        {

            get

            {

                return Get<string>("id");    

            }

            set

            {

                Set("id", value);

            }

        }

        public string name

        {

            get

            {

                return Get<string>("name");

            }

            set

            {

                Set("name", value);

            }

        }

I have also tried id defined as a guid.

I have tried using this to get the stream infor like so

app.GetAppProperties().Get<BIStream>("stream");

Both properties are being returned empty. Feels like I am still missing part of the puzzle. Should i be inheriting from Qlik.Engine.AbstractStructure? Are there any examples that would be of interest?

Øystein_Kolsrud
Employee
Employee

You can always access it as an instance of the AbstractStructure Class. Then you could do something like this:

var streamName = myprop.Get<AbstractStructure>("stream").Get<string>("name");

Not applicable
Author

Hi Øystein that did the trick thank you. Thanks to everyone else too.

Øystein_Kolsrud
Employee
Employee

It looks to me like what you are doing here is perfectly correct. Actually that is exactly how the client structures are implemented in the SDK. Are you sure the app is actually in a stream? It could be that the value of stream for your specific app is simply "null".

You might want to have a look at the full contents of the App properties. You can do this by printing the output of the GetAppProperties operation to the console like this:

using (new DebugConsole())

{

  app.GetAppProperties();

}

That should make it possible for you to see first hand what the contents of the "stream" property is.

As for examples, there is some information relating to AbstractStructure at the following location:

http://help.qlik.com/en-US/sense-developer/3.1/Subsystems/NetSDKAPI/Content/CodeExamples/Abstract-St...

amien
Specialist
Specialist

Any idea why this gives an error on the second line?

Console.WriteLine("AppId : " + appIdentifier.AppId);

Console.WriteLine("Stream : " + appIdentifier.Meta.Get<AbstractStructure>("stream").Get<string>("name"));

An unhandled exception of type 'System.NullReferenceException'

Øystein_Kolsrud
Employee
Employee

My guess is that the "stream" property of the Meta object is null. To verify that you can print the full structure of Meta by doing like this:

Console.WriteLine(appIdentifier.Meta.PrintStructure());

That will show you the full json structure of the Meta object.

amien
Specialist
Specialist

Stream : {"modifiedDate":"2017-03-10T18:50:05.068Z","published":false,"publishTime":"1753-01-01T00:00:00Z","privileges":["read","update","delete"],"description":"","qFileSize":220076,"dynamicColor":"","create":null,"stream":null,"canCreateDataConnections":false}

Stream Null means it's in "Work" "Sheet" right?

Isn't it possible to create the information directly from the stream part in the repository? I mean getting the streams names and apps within a stream from the hub instead of an app?