- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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?
- « Previous Replies
-
- 1
- 2
- Next Replies »
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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");
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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");
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Øystein that did the trick thank you. Thanks to everyone else too.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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?
- « Previous Replies
-
- 1
- 2
- Next Replies »