i am using the add bookmark example provided in the protocol sample. Is there a way to get the logged in user directly without having to re-log in from the sdk?

I am trying to add a bookmark from a smart client plugin, and it is working fine but currently it is log in in using the default windows credential, what i want to achieve is to add the bookmark via the logged in user (basic user) directly without having to enter the username or password.

i tried

LoginSettings ls = LoginSettingsCache.GetLoginSettings(EnvironmentManager.Instance.MasterSite);

and used it:

newBookmark = scs.BookmarkCreate( ls.Token, cameraGuid,

        appointment.SessionStarted.Value,

         appointment.SessionStarted.Value,

        appointment.SessionEnded.Value,

        bookmarkRef.ToString(),

        bookmarkHeader.ToString(),

        bookmarkDesc.ToString());

it is throwing null reference exception .

thanks in advance,

best regards

Hi. Do I understand you correctly, that you are trying to create a bookmark from the Smart Client plugin? If so, could you please send us your plugin, so we can try to reproduce the issue. You can make a test version where any of your sensitive code is removed.

Otherwise, you can see how the bookmark is created in the Protocol sample: BookmarkCreator:

https://doc.developer.milestonesys.com/html/index.html?base=samples/bookmarkcreator.html&tree=tree_search.html?search=bookmark+creater

i need to create a bookmark via the logged-in basic user.

The bookmark creator in the protocol sample creates the bookmark using the window authentication current user.I am able to create the book mark via the protocol sample provided however my missing part is i need the bookmark to be created under the logged in basic user without the need to re-enter any credentials.

thanks in advance.

So are you trying to do it in the Smart Client plugin, when the Smart Client is already logged in with the basic user?

Correct

Then you should use the SC Bookmark sample. It demonstrates how the bookmarks are created in the already logged in Smart Client:

https://doc.developer.milestonesys.com/html/index.html?base=samples/scbookmark.html&tree=tree_1.html

Bookmark bm = BookmarkService.Instance.BookmarkCreate(_currentCamera, _triggerTime.AddSeconds(-10), _triggerTime, _triggerTime.AddSeconds(10), null, text, null);

Thanks,it worked like a charm.