Ticket T739780
Visible to All Users
Duplicate

We have closed this ticket because another page addresses its subject:

Pass login arguments to application

All data is protected when a XAF View is opened from the Outlook Add-In

created 6 years ago

[DevExpress Support Team: CLONED FROM Q94961: How to reuse XAF Views and other standard module functionality in non-XAF apps, forms or controls]
I'm trying to use the example that you shared. Unfortunately, when creating everything you need, all data is protected. What should I do to be able to edit a new object?

Ps. I created an Add-In for Outlook to be able to add a button to the ribbon, and then after clicking the button, launch the XAF> application

C#
public partial class Ribbon { XPObjectSpaceProvider directProvider = null; ExpressAppWindowsFormsApplication theXafApplication = null; private void Ribbon_Load(object sender, RibbonUIEventArgs e) { XpoTypesInfoHelper.GetXpoTypeInfoSource(); XafTypesInfo.Instance.RegisterEntity(typeof(IEDBaseObject)); directProvider = new XPObjectSpaceProvider(DevExpress.Xpo.DB.MSSqlConnectionProvider.GetConnectionString("DESKTOP-GU9BP9N\\SQLEXPRESS01", "sa", "!sql2017", "core"), null); theXafApplication = new ExpressAppWindowsFormsApplication(); theXafApplication.SplashScreen = null; theXafApplication.ShowViewStrategy = new ShowInMultipleWindowsStrategy(theXafApplication); //theXafApplication.ConnectionString = ConfigurationManager.ConnectionStrings["XpoConnectionStringFromAppConfig"].ConnectionString; //theXafApplication.ConnectionString = DevExpress.ExpressApp.Xpo.InMemoryDataStoreProvider.ConnectionString;//Dennis: For demo purposes only. theXafApplication.ConnectionString = DevExpress.Xpo.DB.MSSqlConnectionProvider.GetConnectionString("", "", "", ""); theXafApplication.Setup(); } private void Button1_Click(object sender, RibbonControlEventArgs e) { IObjectSpace objectSpace = theXafApplication.CreateObjectSpace(typeof(IEDBaseObject)); IEDBaseObject obj = objectSpace.CreateObject<IEDBaseObject>(); obj.Sygnatura = "TEST"; //obj.Save(); //objectSpace.CommitChanges(); ShowViewParameters svp = new ShowViewParameters(); DetailView dv = theXafApplication.CreateDetailView(objectSpace, obj, true); dv.ViewEditMode = DevExpress.ExpressApp.Editors.ViewEditMode.Edit; svp.CreatedView = dv; svp.TargetWindow = TargetWindow.NewWindow; theXafApplication.ShowViewStrategy.ShowView(svp, new ShowViewSource(theXafApplication.CreateFrame(TemplateContext.View), null)); } }
Comments (2)
Krzysztof Żołnierz 6 years ago

    how can I run the application without logging in with administrator rights? or to bypass the safety of types?

    I have one more question:
    will my plugin stop working after the automatic update of the application? I would not want to force end users to change the Outlook plugin after each application update.

    DevExpress Support Team 6 years ago

      >> how can I run the application without logging in with administrator rights? or to bypass the safety of types?

      If you are using Security System, it is necessary to authenticate a user before starting the application. Try the solution provided at Q418121 - Pass login arguments to application.

      >> will my plugin stop working after the automatic update of the application?

      I do not have experience with the Outlook Add-In development, so I am afraid I cannot answer this question. However, if you distribute an XAF application as a .NET assembly file that is loaded by the Add-In, I expect that updating the application should be as simple as replacing the existing assembly with a new version.

      Answers approved by DevExpress Support

      created 6 years ago (modified 6 years ago)

      To programmatically authenticate a user, use the solution described at Q418121 - Pass login arguments to application.

        Show previous comments (2)
        DevExpress Support Team 6 years ago

          Hello Krzysztof,

          If you do not want to use the Security System, remove it from the ExpressAppWindowsFormsApplication component. Open the ExpressAppWindowsFormsApplication.cs file in the Visual Studio designer and delete the SecurityStrategy and Authentication components from the design surface.

          If you do not use designers, set the XafApplication.Security property to null programmatically.

          Krzysztof Żołnierz 6 years ago

            I decided to use login from the code. Mainly because the mechanism gives more benefits. Thank you for your help and time.

            DevExpress Support Team 6 years ago

              You are welcome, Krzysztof!

              Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

              Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.