Admin setting form targeting a type projection

Hi

I am writing admin setting form to store users who are authorized for closing incidents. So far, the following is generated:

<TypeDefinitions>
    <EntityTypes>
      <ClassTypes>
        <ClassType ID="Paidar.Custom.AdminSetting" Accessibility="Public" Abstract="false" Base="AdminItem.Library!System.SolutionSettings" Hosted="false" Singleton="true" Extension="false">
          <Property ID="IncidentAssignedToCanClose" Type="bool" AutoIncrement="false" Key="false" CaseSensitive="false" MaxLength="256" MinLength="0" Required="false" Scale="0" />
        </ClassType>
      </ClassTypes>
      <RelationshipTypes>
        <RelationshipType ID="IncidentAuthorizedToClose" Accessibility="Public" Abstract="false" Base="System!System.Reference">
          <Source ID="Source_IncidentAuthorizedToClose_Paidar.Custom.AdminSetting" MinCardinality="0" MaxCardinality="2147483647" Type="Paidar.Custom.AdminSetting" />
          <Target ID="Target_IncidentAuthorizedToClose_Microsoft.AD.User" MinCardinality="0" MaxCardinality="2147483647" Type="WindowsLibrary!Microsoft.AD.User" />
        </RelationshipType>
      </RelationshipTypes>
      <TypeProjections>
        <TypeProjection ID="Projection.Paidar.Custom.AdminSetting" Accessibility="Public" Type="Paidar.Custom.AdminSetting">
          <Component Path="$Context/Path[Relationship='IncidentAuthorizedToClose']$" Alias="IncidentAuthorizedToClose" />
        </TypeProjection>
      </TypeProjections>
    </EntityTypes>
  </TypeDefinitions>

As you see, there is a boolean variable and a relationship to store users who are authorized. When developing custom control for such a class as a Configuration Item we use a list view and bind it to relationship alias, and define a custom form bound to Type Projection. In the CI scenario, everything works fine and just a few line of code will do the trick. My question is how can I achieve this using admin setting? There is a tutorial on Creating custom admin settings which uses wizard data, but I cannot see how can I store relations in that and also how is it possible to assign a type projection to data context.

Any sample code or pointer would be greatly appreciated.

As a side note, I have tried to change Target of console task to type projection, but then nothing happens when double clicking the setting entry, and frankly speaking I am lost. Meanwhile wizard approach requires a lot of coding and I don't know how to define a relation in the WizardData-inherited class, the sample code is like this:

class AdminSettingWizardData : WizardData
    {
        #region Variables

        private String strProperty1 = String.Empty;
        private String strProperty2 = String.Empty;
        private Guid guidEnterpriseManagementObjectID = Guid.Empty;

        public String Property1
        {
            get
            {
                return this.strProperty1;
            }
            set
            {
                if (this.strProperty1 != value)
                {
                    this.strProperty1 = value;
                }
            }
        }

        public String Property2
        {
            get
            {
                return this.strProperty2;
            }
            set
            {
                if (this.strProperty2 != value)
                {
                    this.strProperty2 = value;
                }
            }
        }

        public Guid EnterpriseManagementObjectID
        {
            get
            {
                return this.guidEnterpriseManagementObjectID;
            }
            set
            {
                if (this.guidEnterpriseManagementObjectID != value)
                {
                    this.guidEnterpriseManagementObjectID = value;
                }
            }
        }

        #endregion

        internal AdminSettingWizardData(EnterpriseManagementObject emoAdminSetting)
        {
..... omitted for brevity
As far as I know, there must be a Listof IDataItem defined and bound to item source property of SortableListView control.

Thanks

June 20th, 2015 3:34pm

I think I can help you out with this one. First, let's make sure you're familiar with what an admin setting object is. First off, it's a Singleton. Meaning there will only ever be 1 "admin setting" object of your class.

If I understand correctly, you're trying to relate user objects to this admin setting object in order to affect some behavior and, at the same time, apply a setting to them to give them permission to do something or not (hence the boolean). First, I'm not sure what the boolean is for.

For example, if I want to give permission to people who are related to my admin setting object, I just relate them. The relationship itself indicates whether a user has the appropriate permission. In that case, the boolean property is unnecessary.

With that in mind (and if my understanding is correct) re-think your schema. You have a single admin setting object and relationships between it and some users. Users who are related to it have permission to do whatever.

As for the wizard setting code..the wizard code is, in my opinion, unnecessarily complicated. You don't have to create a wizard driven form if you don't want. You can create your own WPF form (it should be a vanilla form, not a typical SCSM form). You can create a standard Windows form, whatever interface you want. The act of double-clicking (or clicking edit) on the object will prepare and present your interface. Notice, in Travis's demo that all of the interaction starts with a console task. Edit, Delete, etc, are nothing more than console tasks. (It's actually a single console task with a parameter). Since your admin setting is a singleton, you can hard-code its ID directly into your interface and start manipulating it with the standard SDK. When you're done, commit() or overwrite() the changes. You might notice that Travis's demo doesn't even use the console API..he strictly uses the standard SDK to make all of his changes.

The wizard stuff makes things look far more complicated than they need to be. Here's some advice to start off simple:

First off, be aware that since your admin setting class is a singleton, the act of importing the MP automatically creates your admin setting object. All you have to do, for my next piece of advice, is query the database to get the object's ID. (similar to how Travis has strSingletonBaseManagedObjectId = "adsfljkadslkfjljsdf")

So, start off by creating a little console task that:

1) Retrieves that admin setting object via the standard SDK using the object's base managed entity Id
2) Displays the object's information in some interface (Wpf, windows form, whatever you prefer)

Let me know if that helps clear up some of the confusion :) I'll try to help you through the rest.

Free Windows Admin Tool Kit Click here and download it now
June 20th, 2015 6:58pm

Hi Aaron, 

Thanks for your answer, I couldn't get the meaning of "vanilla form" even by searching google :) . I am going to provide you steps taken so far and my current situation, please check if I am even in the right path.

Here is the part where console command is triggered:

public override void ExecuteCommand(IList<NavigationModelNodeBase> nodes, NavigationModelNodeTask task, ICollection<string> parameters)
        {

            //Getting the emg
            Microsoft.EnterpriseManagement.UI.Core.Connection.IManagementGroupSession session = (Microsoft.EnterpriseManagement.UI.Core.Connection.IManagementGroupSession)FrameworkServices.GetService<Microsoft.EnterpriseManagement.UI.Core.Connection.IManagementGroupSession>();
            EnterpriseManagementGroup emg = session.ManagementGroup;

            PaidarAdminSettingsUC obj = new PaidarAdminSettingsUC(emg);
            obj.ShowDialog();
        }


PaidaAdminSettingUC.xaml is defined like this:

<Window x:Class="PaidarAdminSettings.PaidarAdminSettingsUC"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:scwpf="http://schemas.microsoft.com/SystemCenter/Common/UI/Wpf"
             xmlns:toolbox="clr-namespace:Microsoft.EnterpriseManagement.UI.WpfToolbox;assembly=Microsoft.EnterpriseManagement.UI.FormsInfra"
             xmlns:smcontrols="clr-namespace:Microsoft.EnterpriseManagement.UI.WpfControls;assembly=Microsoft.EnterpriseManagement.UI.SMControls"
             xmlns:views="clr-namespace:Microsoft.EnterpriseManagement.UI.FormsInfra;assembly=Microsoft.EnterpriseManagement.UI.FormsInfra"
             xmlns:wpfToolKit="clr-namespace:Microsoft.Windows.Controls;assembly=wpfToolKit"
             xmlns:sys="clr-namespace:System;assembly=mscorlib"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="500" Loaded="UserControl_Loaded">

    <scwpf:BusinessLogic.Rules>
        <scwpf:RuleCollection>
            <!-- Set Window Title -->
            <scwpf:Rule>
                <scwpf:Rule.Triggers>
                    <scwpf:PropertyChangedTrigger Binding="{Binding RelativeSource={x:Static RelativeSource.Self}, Path=DataContext}"/>
                    <scwpf:RoutedEventTrigger RoutedEvent="FrameworkElement.Loaded"/>
                </scwpf:Rule.Triggers>
                <scwpf:Rule.Conditions>
                    <scwpf:PropertyMatchCondition Binding="{Binding RelativeSource={x:Static RelativeSource.Self}, Path=DataContext}" Operation="NotEquals">
                        <scwpf:PropertyMatchCondition.Value>
                            <x:Null/>
                        </scwpf:PropertyMatchCondition.Value>
                    </scwpf:PropertyMatchCondition>
                    <scwpf:PropertyMatchCondition Binding="{Binding RelativeSource={x:Static RelativeSource.Self}, Path=IsLoaded}">
                        <scwpf:PropertyMatchCondition.Value>
                            <sys:Boolean>True</sys:Boolean>
                        </scwpf:PropertyMatchCondition.Value>
                    </scwpf:PropertyMatchCondition>
                </scwpf:Rule.Conditions>
                <scwpf:ModifyPropertyAction Binding="{Binding RelativeSource={x:Static RelativeSource.Self},
                                                              Path=(views:FormView.WindowTitle),
                                                              Mode=TwoWay}">
                    <scwpf:ModifyPropertyAction.ValueBinding>
                        <MultiBinding Mode="OneWay">
                            <MultiBinding.Converter>
                                <scwpf:FormatterConverter>{0}</scwpf:FormatterConverter>
                            </MultiBinding.Converter>
                            <Binding Path="None" Mode="OneWay" FallbackValue="Paidar Custom Admin Settings"/>
                        </MultiBinding>
                    </scwpf:ModifyPropertyAction.ValueBinding>
                </scwpf:ModifyPropertyAction>
            </scwpf:Rule>
        </scwpf:RuleCollection>
    </scwpf:BusinessLogic.Rules>
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition />
            <ColumnDefinition />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="20*"/>
            <RowDefinition Height="5*"/>
        </Grid.RowDefinitions>
        <TabControl x:Name="PaidarSettingsTabControl" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Grid.Row="0" Grid.ColumnSpan="2">
            <TabItem Header="Incident" x:Name="tabItemIncident">
                <Grid>
                    <StackPanel Name="stackPanel" Orientation="Vertical" Margin="10,20">

                        <CheckBox Content="Incident AssignedTo can close incidents" IsChecked="{Binding Path=IncidentAssignedToCanClose, Mode=TwoWay}" />
                        <Label Content="List of Persons who are allowed to close an incident:"  Margin="10,5,10,0"/>
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="*"/>
                                <RowDefinition Height="*"/>
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="530*"/>
                                <ColumnDefinition Width="70*"/>
                            </Grid.ColumnDefinitions>

                            <StackPanel Grid.Row="0" Grid.Column="0">
                                <scwpf:SortableListView x:Name="lsvIncidentUsersToClose" ItemsSource="{Binding IncidentAuthorizedToClose}" Width="Auto" Height="Auto" MinHeight="120" MinWidth="110" 
                                                        HorizontalAlignment="Stretch" VerticalAlignment="Stretch" HorizontalContentAlignment="Stretch" MaxHeight="600" MouseDoubleClick="lsvIncidentUsersToClose_MouseDoubleClick">
                                    <scwpf:SortableListView.View>
                                        <GridView>
                                            <!--<scwpf:SortableGridViewColumn SortPropertyName="DisplayName" DisplayMemberBinding="{Binding DisplayName}" Header="Display Name" Width="Auto"/>-->
                                            <scwpf:SortableGridViewColumn SortPropertyName="Username" DisplayMemberBinding="{Binding Username}" Header="Username" Width="Auto"/>
                                        </GridView>
                                    </scwpf:SortableListView.View>
                                </scwpf:SortableListView>
                            </StackPanel>
                            <StackPanel Grid.Row="0" Grid.Column="1" VerticalAlignment="Top">
                                <Button x:Name="btnAdd_lsvIncidentUsersToClose" Content="Add" Margin="0,0,0,0" Click="btnAdd_lsvIncidentUsersToClose_Click" />
                                <Button x:Name="btnRemove_lsvIncidentUsersToClose" Content="Remove" Margin="0,5,0,0" Click="btnRemove_lsvIncidentUsersToClose_Click" />
                                <Button x:Name="btnOpen_lsvIncidentUsersToClose" Content="Open" Margin="0,5,0,0" Click="btnOpen_lsvIncidentUsersToClose_Click" />
                            </StackPanel>
                        </Grid>
                    </StackPanel>                   

                </Grid>
            </TabItem>
            <TabItem Header="Service Request" x:Name="tabItemServiceRequest">
                <Grid Background="#FFE5E5E5"/>
            </TabItem>
        </TabControl>

        <StackPanel Grid.Row="1" Grid.ColumnSpan="2" VerticalAlignment="Bottom" Orientation="Horizontal" FlowDirection="RightToLeft" Margin="10,15" >
            <Button Content="Cancel" HorizontalAlignment="Right" VerticalAlignment="Bottom" Width="75" Margin="0,0,5,0"/>
            <Button Content="Save" HorizontalAlignment="Right" VerticalAlignment="Bottom" Width="75"/>
        </StackPanel>
    </Grid>
</Window>


Sorry for long code, but I'd rather provide you with the whole form so you can copy and paste it for getting a clear picture. 

PaidarAdminSettingsUC.xml.cs is defined like this:

public bool IncidentAssignedToCanClose { get; set; }

private Collection<IDataItem> _IncidentsAuth = new Collection<IDataItem>();
        public Collection<IDataItem> IncidentAuthorizedToClose
        {
            get
            {
                return _IncidentsAuth;
            }

            set
            {
                _IncidentsAuth = value;
            }
        }
//Constructor
public PaidarAdminSettingsUC(EnterpriseManagementGroup emg)
        {
            InitializeComponent();

            String strSingletonBaseManagedObjectIDProjection = "75bd24d3-7d38-62da-6517-22bbe2d27a4d";
            ManagementPackTypeProjection mptpAdminSetting = emg.EntityTypes.GetTypeProjection(new Guid(strSingletonBaseManagedObjectIDProjection));
            IObjectProjectionReader<EnterpriseManagementObject> objectProjections =
                emg.EntityObjects.GetObjectProjectionReader<EnterpriseManagementObject>(
                new ObjectProjectionCriteria(mptpAdminSetting), ObjectQueryOptions.Default);
            //for geting enterprisemanagement object
            EnterpriseManagementObject emoAdminSetting = objectProjections.FirstOrDefault().Object;
            //this.DataContext = emoAdminSetting;
        }

private void btnAdd_lsvIncidentUsersToClose_Click(object sender, RoutedEventArgs e)
        {
            //Active Directory User (Microsoft.Windows.Library) (Microsoft.AD.User) (10a7f898-e672-ccf3-8881-360bfb6a8f9a)
            AddItemToListView(this.lsvIncidentUsersToClose, new Guid("10a7f898-e672-ccf3-8881-360bfb6a8f9a"));
        }


        internal static void AddItemToListView(ListView listView, Guid classId)
        {
            if (listView != null && listView.Items != null)
            {
                InstancePickerDialog ciPicker = new InstancePickerDialog();
                ciPicker.ClassId = classId;
                ciPicker.SelectionMode = SelectionMode.Multiple;

                if (listView.Items.Count > 0)
                {
                    ciPicker.SetPickedInstances((Collection<IDataItem>)listView.ItemsSource);
                }

                bool? result = ciPicker.ShowDialog();
                if (result != null && result == true)
                {
                    Collection<IDataItem> items = listView.ItemsSource as Collection<IDataItem>;
                    foreach (IDataItem item in ciPicker.RemovedInstances)
                        items.Remove(item);

                    foreach (IDataItem item in ciPicker.PickedInstances)
                        if (!items.Contains(item))
                            items.Add(item);
                }
            }
        }

        internal static void RemoveItemFromWorkItemListView(ListView listView)
        {
            if (listView.ItemsSource == null ||
                            listView.SelectedItems == null ||
                            listView.SelectedItems.Count == 0)
            {
                return;
            }

            Collection<IDataItem> items = listView.ItemsSource as Collection<IDataItem>;
            if (items != null)
            {
                foreach (object obj in new ArrayList(listView.SelectedItems))
                {
                    /* NOTE: The use of the IDataItem interface here is not supported/documented.
                    * This interface may change in the future and no migration path is guaranteed 
        by Microsoft.
                    */
                    items.Remove(obj as IDataItem);
                }
            }
        }

That was it so far, I don't know if it is correct to bind these controls (like ordinary WPF controls) but it gives me error because ItemsSource property of SortableListView is null. The line which is throwing error is 

Collection<IDataItem> items = listView.ItemsSource as Collection<IDataItem>;

inside AddItemToListView function. Sorry for this long question.

Thanks in advance

June 21st, 2015 6:14am

Yep, you're on the right track :)

One thing that seems to be missing (And I admit, I just got out of bed), it doesn't look like you set your form's data context to your admin setting object.

Since you're using a WPF form, it would probably be best to get the IDataItem version of your admin setting object (I should have mentioned that earlier, sorry). IDataItems are designed for WPF binding. EnterpriseManagementObject class objects do not support WPF binding out of the box (at least they didn't the last time I tried it). You can use the ConsoleContextHelper.Instance to get your object and/or your projection.

oh, and when I said "vanilla form", it's slang for "conventional"..meaning it's _not_ a SCSM WPF Form.

Free Windows Admin Tool Kit Click here and download it now
June 21st, 2015 9:18am

There seems to be a lot of conflicts in my head (Which I'd better resolve them before forgetting them)  :D .

Here is what I do to get the required IDataItem and set WPF form DataContext, and possibly nothing came out of it:

I tried getting ProjectionInstance using the following code:

internal const string MP_PROPERTY_ID_DOLLAR = "$Id$";

internal const string MP_PROJECTION_TYPE_INCIDENT_ASSIGNEDTO_AUTHORIZED_TO_CLOSE = "75bd24d3-7d38-62da-6517-22bbe2d27a4d";

public override void ExecuteCommand(IList<NavigationModelNodeBase> nodes, NavigationModelNodeTask task, ICollection<string> parameters)
        {
            
            //Getting the emg
            Microsoft.EnterpriseManagement.UI.Core.Connection.IManagementGroupSession session = (Microsoft.EnterpriseManagement.UI.Core.Connection.IManagementGroupSession)FrameworkServices.GetService<Microsoft.EnterpriseManagement.UI.Core.Connection.IManagementGroupSession>();
            EnterpriseManagementGroup emg = session.ManagementGroup;
            
            IDataItem dataItemNode = nodes[0];
            IDataItem IncidentAuthorizedToCloseProjectionInstance =
                Microsoft.EnterpriseManagement.UI.Extensions.Shared.ConsoleContextHelper.Instance.GetProjectionInstance(
                        (Guid)dataItemNode[MP_PROPERTY_ID_DOLLAR], new Guid(MP_PROJECTION_TYPE_INCIDENT_ASSIGNEDTO_AUTHORIZED_TO_CLOSE));

            PaidarAdminSettingsUC obj = new PaidarAdminSettingsUC(emg, IncidentAuthorizedToCloseProjectionInstance);
            obj.ShowDialog();

This code throws an exception because dataItemNode[MP_PROPERTY_ID_DOLLAR] is null :) (very happy about it). (dataItemNode is type of "Microsoft.EnterpriseManagement.UI.SdkDataAccess.ManagementPackClassNode"). 

I managed to get projectionType using this code:

IDataItem proj = Microsoft.EnterpriseManagement.UI.Extensions.Shared.ConsoleContextHelper.Instance.GetProjectionType(new Guid("75bd24d3-7d38-62da-6517-22bbe2d27a4d"));

But as far as I know, I must use ProjectionInstance and as you said it must be read from ConsoleContextHelper.Instance.

Now my question is, how can I get this lovely projection using ConsoleContextHelper.Instance, and please correct my logic if it is wrong.

Thanks

June 21st, 2015 12:32pm

Instead of getting the Id from the node, input the Guid directly into the GetProjectionInstance method. Similar to how Travis used the strSingletonBaseManagedObjectId variable. Your admin setting object's guid will be in the SQL table MT_Paidar$Custom$AdminSetting. There will only be one object in there since it's a singleton. Use the BaseManagedEntityId guid.
Free Windows Admin Tool Kit Click here and download it now
June 21st, 2015 1:16pm

I created a console application to test this ProjectionInstance and unfortunately it returns null. Here is what I did:

SELECT [BaseManagedEntityId]      
  FROM [ServiceManager].[dbo].[MT_Paidar$Custom$AdminSetting]

  select [BaseManagedEntityId]  from BaseManagedEntity where DisplayName like '%Paidar Custom%'


Both of these SQL queries returned "381193F5-DC91-1A32-0310-29928168623C". Meanwhile using Rob Ford's List GUID application, the following line returned for type projection:

(PaidarAdminSetting)  (Projection.Paidar.Custom.AdminSetting) (75bd24d3-7d38-62da-6517-22bbe2d27a4d)

So, according to your suggestion, the following returns Projection instance (which unfortunately doesn't):

var inst = Microsoft.EnterpriseManagement.UI.Extensions.Shared.ConsoleContextHelper.Instance.GetProjectionInstance(new Guid("381193F5-DC91-1A32-0310-29928168623C"),
                               new Guid("75bd24d3-7d38-62da-6517-22bbe2d27a4d"));

May I ask to provide you my code to test it for your self please? If you could probably provide me with a working minimal example or correct my issue, that would be great.

Thanks a lot. 

June 21st, 2015 2:50pm

Sure, post your management pack xml and I'll try it out myself. The guids will be different since I'll have to seal it with my own key, but that shouldn't make a difference.
Free Windows Admin Tool Kit Click here and download it now
June 21st, 2015 3:10pm

Please send me an email to Yassermat(2)gmail(dot)com. Thanks
June 21st, 2015 3:14pm

You can download it from my one drive public folder 
Free Windows Admin Tool Kit Click here and download it now
June 21st, 2015 5:05pm

I'll take a look at it this evening and get back to you
June 22nd, 2015 9:41am

I don't want to ruin your day..but..your code worked fine. I didn't change anything and it was adding users exactly as expected.

The only glitch was your DisplayMemberBinding was binding "Username" instead of "UserName" (note the case), but the user was still there in the listbox.

After the dialog closes, simply calling:

ConsoleContextHelper.Instance.UpdateEnterpriseManagementObjectProjectionInstances(new List<IDataItem>() { IncidentAuthorizedToCloseProjectionInstance });
in your AdminSettingCommand class creates the appropriate relationships.

You said the GetProjectionInstance was returning null? Try clearing your console cache, recompile your DLL and make sure you're bundling the latest copy of it, import the new MPB and restart the console. 

Free Windows Admin Tool Kit Click here and download it now
June 22nd, 2015 7:55pm

I don't want to ruin your day..but..your code worked fine. I didn't change anything and it was adding users exactly as expected.

The only glitch was your DisplayMemberBinding was binding "Username" instead of "UserName" (note the case), but the user was still there in the listbox.

After the dialog closes, simply calling:

ConsoleContextHelper.Instance.UpdateEnterpriseManagementObjectProjectionInstances(new List<IDataItem>() { IncidentAuthorizedToCloseProjectionInstance });
in your AdminSettingCommand class creates the appropriate relationships.

You said the GetProjectionInstance was returning null? Try clearing your console cache, recompile your DLL and make sure you're bundling the latest copy of it, import the new MPB and restart the console. 

  • Marked as answer by YSobhdel 14 hours 36 minutes ago
June 22nd, 2015 11:52pm

I don't want to ruin your day..but..your code worked fine. I didn't change anything and it was adding users exactly as expected.

The only glitch was your DisplayMemberBinding was binding "Username" instead of "UserName" (note the case), but the user was still there in the listbox.

After the dialog closes, simply calling:

ConsoleContextHelper.Instance.UpdateEnterpriseManagementObjectProjectionInstances(new List<IDataItem>() { IncidentAuthorizedToCloseProjectionInstance });
in your AdminSettingCommand class creates the appropriate relationships.

You said the GetProjectionInstance was returning null? Try clearing your console cache, recompile your DLL and make sure you're bundling the latest copy of it, import the new MPB and restart the console. 

  • Marked as answer by YSobhdel Tuesday, June 23, 2015 4:38 PM
Free Windows Admin Tool Kit Click here and download it now
June 22nd, 2015 11:52pm

I don't want to ruin your day..but..your code worked fine. I didn't change anything and it was adding users exactly as expected.

The only glitch was your DisplayMemberBinding was binding "Username" instead of "UserName" (note the case), but the user was still there in the listbox.

After the dialog closes, simply calling:

ConsoleContextHelper.Instance.UpdateEnterpriseManagementObjectProjectionInstances(new List<IDataItem>() { IncidentAuthorizedToCloseProjectionInstance });
in your AdminSettingCommand class creates the appropriate relationships.

You said the GetProjectionInstance was returning null? Try clearing your console cache, recompile your DLL and make sure you're bundling the latest copy of it, import the new MPB and restart the console. 

  • Marked as answer by YSobhdel Tuesday, June 23, 2015 4:38 PM
June 22nd, 2015 11:52pm

I don't want to ruin your day..but..your code worked fine. I didn't change anything and it was adding users exactly as expected.

The only glitch was your DisplayMemberBinding was binding "Username" instead of "UserName" (note the case), but the user was still there in the listbox.

After the dialog closes, simply calling:

ConsoleContextHelper.Instance.UpdateEnterpriseManagementObjectProjectionInstances(new List<IDataItem>() { IncidentAuthorizedToCloseProjectionInstance });
in your AdminSettingCommand class creates the appropriate relationships.

You said the GetProjectionInstance was returning null? Try clearing your console cache, recompile your DLL and make sure you're bundling the latest copy of it, import the new MPB and restart the console. 

  • Marked as answer by YSobhdel Tuesday, June 23, 2015 4:38 PM
Free Windows Admin Tool Kit Click here and download it now
June 22nd, 2015 11:52pm

Hi, Thanks Aaron, you saved my day, definitely you are a life saver :) .

Clearing cache was the major solution, after that type projection returned.

Thanks again.

June 23rd, 2015 12:41pm

You're welcome :) I'm glad I could help

Free Windows Admin Tool Kit Click here and download it now
June 23rd, 2015 1:32pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics