Manage Site App Permissions Programmatically?

Hello,
Is it possible to manage a site's app permissions programmatically? (site settings -> site app permissions)
I am deploying a SharePoint-Hosted App to an on-premises instance of SharePoint 2013 using server object model:
SPAppInstance instance = web.LoadAndInstallApp(stream);
The app requires some permissions (Web, Read). I would like to trust the app programmatically as well.
Thank you!
Andre

For anyone that's interested, I came across a similar requirement. The code above is a good start, but it assumes that the app principal is already created (i.e. LookupAppPrincipal). Unfortunately, when installing an app, the app principal doesn't exist
and isn't created (unless of course it was done so manually). So, the code below is a variation of the above code, for when an app principal must first be created before being assigned permissions.
SPAppInstance appInstance = web.LoadAndInstallApp(package);
char[] separators = { '|', '@' };
string appPrincipalIdentifier = appInstance.AppPrincipalId.Split(separators)[2];SPAppPrincipalPermissionsManager permissionsManager = new SPAppPrincipalPermissionsManager(web);
SPAppPrincipalManager principalManager = SPAppPrincipalManager.GetManager(web);
List<string> endpoints = new List<string>();
endpoints.Add("<EndPoint Authority>");
SecureString secureString = new SecureString();DateTime now = DateTime.Now;SPAppPrincipalCredential credential = SPAppPrincipalCredential.CreateFromSymmetricKey(secureString, now, now);SPExternalAppPrincipalCreationParameters creationParameters = new SPExternalAppPrincipalCreationParameters(
appPrincipalIdentifier,
"<Display Name>",
endpoints,
credential
SPAppPrincipal principal = principalManager.CreateAppPrincipal(creationParameters);
permissionsManager.AddAppPrincipalToWeb(principal, SPAppPrincipalPermissionKind.FullControl

Similar Messages

  • Missing workflow app identifier in Site App Permissions

    Hi everyone,
    I´m wondering if anyone can help me with this issue: I can´t get the Workflow app identifier to appear (again) in Site App Permissions. I was having some trouble with workflow permissions after changes in our SharePoint environment and decied to
    delete the Workflow app permissions and de-activate the "Workflows can use app permissions", and re-activate to hopefully get things working again...
    Issue:
    However, when I activate the feature (again), the App identifier does not appear in the "Site App Permission".
    Can anyone tell me how to acivate/add this identifier other than with activating the site feature?
    -Why SharePoint, why?-

    Hi,
    For your issue, Try to do the steps below:
    Navigate to _layouts/15/appinv.aspx i.e. grant permission to app page.
    Type app identifier and click Lookup, it will generate Title.
    Type App Domain such as contosoapps.domain.
    Type the following to App's Permission Request XML.
    Click Create, it will pop up SharePoint app, and click Trust it.
    <AppPermissionRequests>
    <AppPermissionRequest
    Scope="http://sharepoint/content/sitecollection"
    Right="FullControl" />
    </AppPermissionRequests>
    Besides, App permissions in SharePoint 2013, refer to it:
    http://msdn.microsoft.com/en-us/library/jj822159.aspx
     http://msdn.microsoft.com/en-us/library/office/fp142383(v=office.15).aspx
    Best Regards,
    Lisa Chen
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Lisa Chen
    TechNet Community Support

  • Message (on one account) when logging in: The user account running the Configuration Manager console has insufficient permissions to read information from the Configuration Manager site database.

    After installing the reportservice/database i cannot use the Configuration Manager Console 2012 anymore with my own AD account. (The accounts of my colleagues are stil working)
    When i login i get the following message:
    The user account running the Configuration Manager console has insufficient permissions to read information from the Configuration Manager site database. The account must belong to a security role in Configuration Manager. The account must also have
    the Windows Server Distributed Component Object Model (DCOM) Remote Activation permission for the computer running the Configuration Manager site server and the SMS Provider.
    I checked the following:
    I am a administrative user in SCCM (Full Administrator)
    I am a member of the administrator group on the server
    Deleted HKEY_CURRENT_USER\Software\Microsoft\ConfigMgr10
    I tried to start it on multiple workstations and deleted my roaming profile
    Any more suggestions?

    Hi,
    Maybe you could have a look on the below blog.
    http://blog.nimbo.com/how-to-disable-user-account-control-in-windows-server-2012/
    (Note: Microsoft provides third-party contact information to help you find technical support. This contact information
    may change without notice. Microsoft does not guarantee the accuracy of this third-party contact information.)
    Best Regards,
    Joyce Li
    We
    are trying to better understand customer views on social support experience, so your participation in this
    interview project would be greatly appreciated if you have time.
    Thanks for helping make community forums a great place.

  • App permissions manager for z1 compact

    Hey guys, does anyone know about any app permissions manager that works without root on a Z1 compact?
    As far as I know the battery issue can only be solved by restricting the permissions for Google services and Google play services apps.
    Please let me know if there is any way to change app permissions without having to root the phone.

    AFAIK, this only can be done with rooting, I never heard of a possible way to set app permissions without root. Let's wait from @alexdon or @Thommo to confirm that.
    A proud Sony User since 2002
    If I was helpful to you, thank me by Kudos

  • Cannot activate "Workflows can use app permissions"

    Dear all,
    I have a SharePoint 2013 on Windows Server 2008 R2.
    And I create a develop site to share my apps.
    First, I try to activate the app permission, but it fail.
    Is anybody knows how to fix it?
    Thank you!

    Workflows can use app permissions feature is only going to be activated if 
    1) You have configured your workflow manager properly. Make sure there are not issues with your workflow manager and you can create workflow using SP 2013 Workflow Manager.
    2) You have configured apps for SharePoint 2013. Again you will need to make sure that you have hit all the check when configuring SharePoint 2013 apps. 
    Follow these two articles to make sure that you have configured apps for SharePoint 2013.
    http://technet.microsoft.com/en-us/library/fp161236.aspx
    http://sharepointchick.com/archive/2012/07/29/setting-up-your-app-domain-for-sharepoint-2013.aspx
    If you have confirmed that both of the above features are configured properly then check your ULS logs and find the detailed issue using the Correlation ID.
    Amit

  • Manage Sites/FTP: Can't see site files in local view.

    Dreamweaver 5.5
    Mac OS X.6.8
    I have several sites set up in Dreamweaver. All are working correctly except one. This one site I moved files using Finder into a deeper directory and then moved them back up to the top level directory. I have been working with the site since and saving, so that's not the issue. I am mentioning it because that is the only unique thing about the site that isn't working.
    When I look at the site in the Files panel, I can see the directory I set up in Manage Sites but no files inside it. If I put all to my remote site, 0 bytes are transferred.
    So far I have
    1. removed the site and created a new one.
    2. Closed the app, blown away Drmwvr prefs, and reopened. The site is still there, so that prefs file doesn't cover it.
    Any ideas? I cannot FTP files to my host if Dreamweaver doesn't "see" the files I need to put.
    Thx
    Jacqueline

    2000sowell wrote:
    Dreamweaver 5.5
    Mac OS X.6.8
    I have several sites set up in Dreamweaver. All are working correctly except one. This one site I moved files using Finder into a deeper directory and then moved them back up to the top level directory. I have been working with the site since and saving, so that's not the issue. I am mentioning it because that is the only unique thing about the site that isn't working.
    When I look at the site in the Files panel, I can see the directory I set up in Manage Sites but no files inside it. If I put all to my remote site, 0 bytes are transferred.
    So far I have
    1. removed the site and created a new one.
    2. Closed the app, blown away Drmwvr prefs, and reopened. The site is still there, so that prefs file doesn't cover it.
    Any ideas? I cannot FTP files to my host if Dreamweaver doesn't "see" the files I need to put.
    Thx
    Jacqueline
    Moving files in Finder is fine as long as you can follow the moves in your files panel. Troubles start when you move files outside of DW and then can't keep up with them. Broken links, orphaned pages, etc.
    In Sites>Manage Sites you need to Edit the site in question and browse to the new root folder location. Then browse to the images folder and SpryAssets folder if you have one. Once you have redefined the site with the proper locations, the files will appear in the panel in DW.
    As long as you haven't deviated from the correct structure on the server, you should be able to put files and they will upload.
    As a rule, when moving or renaming files in a defined site, do it from within the Files Panel in DW, not in Finder. DW will update links and pages when you do and things will go much more smoothly.

  • No WebApps in "Manage Site Features"

    We have a standalone Sharepoint Foundation Server, Windows 2008, 64bit.
    I have installed the Office Web Apps, everything was going fine, no error or such. Even the Products configuration wizzard gave me no errors.
    After installing i saw in the "central administration", that the services where already started (in "manage services on the server"). Same at "manage service applications". Everything already was there for excel, word and powerpoint.
    My problem is, i cant activate the features on my sites now, because on the "manage site features" i cant see any sign of the WebApps.
    I can't open any of the files. In word, there is just a blank site with a header there, telling me in which path i am atm. In Excel i get the message: "An Error have occured. Please try again" I can see the ribbin above tho, but file wont open.
    Any idea what i can to or what maybe the mistake is here?
    Nina

    I get the following error:
    Get-SPSite : A positional parameter cannot be found that accepts argument 'Enab
    le-SPFeature'.
    At line:1 char:35
    + $singleSiteCollection = Get-SPSite <<<<  -Identity
    http://zkemportal01 Enable
    -SPFeature $webAppsFeatureId -Url $singleSiteCollection.URL
        + CategoryInfo          : InvalidArgument: (:) [Get-SPSite], ParameterBind
       ingException
        + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.SharePoint
       .PowerShell.SPCmdletGetSite
    I switched <site_name> with our servername, but still there is something wrong.

  • Dreamweaver CS6 Hangs Upon Exiting "Manage Sites"

    Anytime I edit an existing site or add a new site under "Manage Sites" and click "Done", Dreamweaver will hang with the spinning beach ball for 5-6 minutes.  During that time the app is unusable.  A pretty bad bug.  After the hang time, the app works fine.
    Help?

    I have the same problem.
    Windows 7 x64, 12GB Ram, Dual Xeon 2.66 processors (12 threads)
    Dreamweaver CS6 v12 build 5808.
    It will freeze for 3-4 minutes and it is unusable. Then it works as normal. Seems to freeze when I open a file, save or switch between files in the app.
    I tried to Disable Dreamweaver's Resolve To IP Address feature:
    http://helpx.adobe.com/dreamweaver/kb/hang-opening-document-dreamweaver-cs5.html
    it did not help.

  • Unable to activate Workflows can use app permissions feature

    Hi all,
    Iam unable to activate Workflows can use app permissions feature in sharepoint 2013. it throws sorry something went wrong error. Kindly somebody help me in resolving this issue

    Workflows can use app permissions feature is only going to be activated if 
    1) You have configured your workflow manager properly. Make sure there are not issues with your workflow manager and you can create workflow using SP 2013 Workflow Manager.
    2) You have configured apps for SharePoint 2013. Again you will need to make sure that you have hit all the check when configuring SharePoint 2013 apps. 
    Follow these two articles to make sure that you have configured apps for SharePoint 2013.
    http://technet.microsoft.com/en-us/library/fp161236.aspx
    http://sharepointchick.com/archive/2012/07/29/setting-up-your-app-domain-for-sharepoint-2013.aspx
    If you have confirmed that both of the above features are configured properly then check your ULS logs and find the detailed issue using the Correlation ID.
    If this helped you resolve your issue, please mark it Answered

  • Hello! I am trying to sync my iPhone 4 to my iTunes. My phone is connected to my computer, (was able to import pics) but I cannot manage my apps or music in iTunes. I ran diagnostics and it says 'no iPhone found'. The device cannot be restored in iTunes.

    Hello! I am trying to sync my iPhone 4 to my iTunes. My phone is connected to my computer, (was able to import pics) but I cannot manage my apps or music in iTunes. I ran diagnostics and it says 'no iPhone found'. It then takes me to Apple Support that says:
    The device cannot be restored in iTunes.
    An exclamation point, question mark, plug symbol, or "X" appears next to the device's entry in Device Manager.
    During an update or restore, the device may no longer be recognized by iTunes
    HELP!

    Hello, Shandey. 
    Thank you for visiting Apple Support Communities. 
    With the symptoms you described, try the step in the article below.  See the section labeled Verify that the Apple Mobile Device USB Driver is installed > If the device is not recognized while in Recovery Mode and If you see two "Apple Mobile Device (Recovery Mode)" entries with exclamation marks on them.  Then select the appropriate operating system that you are using. 
    iOS: Device not recognized in iTunes for Windows
    http://support.apple.com/kb/ts1538
    Cheers,
    Jason H. 

  • Managing Sites In DW CS3

    I some how changed my settings and my local files address is
    now preceded by ftp:// . I use to be able to see files in expanded
    form for both Local and Remote files. How do I change back to what
    I had before? My site's home page is now all messed up since some
    of the links have been changed.

    Since you use standard
    http:// protocol, and since your online site can
    be viewed properly, you are likely well-positioned for a full
    recovery.
    STEP ONE: If, as you have suggested, your local and remote
    Dreamweaver folders appear identical, then everything that you have
    online is likely also on your local hard disk. Just in case it is
    not, you should back up your local folder before taking any further
    action. Move it to a safe place and even change its name so as to
    avoid confusion.
    STEP TWO: After having backed up your local folder, delete
    your site from your Manage Sites menu. This will destroy
    Dreamweaver's record of your online site, so that you can start
    over.
    STEP THREE: Return to the Manage Sites Menu and click on New.
    Make sure that you select Site and not FTP/RDS.
    STEP FOUR: If you can understand the Advanced tab, use it to
    create your new site. Otherwise, use the Basic tab and begin from
    scratch. In either case download what is online back into your
    computer, so as to be sure that everything on you computer is as it
    appears online.
    STEP FIVE: If there is anything missing in your newly created
    local folder, then you can recover it by copying from the folder
    that you backed up. Copy only content -- HTML, JPEG, and the like.
    It is probably best not to copy anything created by Dreamweaver, as
    you do not appear sufficiently familiar with the application to
    know what could hurt or harm you.
    Roddy

  • How to manage Shared Inbox Permissions with a Group

    I am trying to manage a shared inbox access rights and send as permissions with a security group.  My server is a 2013 CU7.  What I did is create a mailbox called HR.  Then I created a security group called HR Group.  I then assigned
    the HR Group to the HR Shared mailbox with the EAC and cmd-lets to allow HR Group fullaccess and send-as rights.  The permissions do not seem to be applied even though the group shows in the EAC mailbox delegation window.  When I go to access/send
    as I get permission denied.  Is there a way to use groups for this?  When I explicitly give myself permission to the HR shared mailbox it works fine.  Any thoughts?

    Hi,
    Please check the permissions that the HR group has on HR mailbox by the following command:
    Get-MailboxPermission -Identity “HR” –User “HR group”
    Please try to grant HR mailbox full access and send as permission to HR Group with the following command again to check this issue:
    Add-MailboxPermission -Identity “HR” –User “HR group” -AccessRights “FullAccess” -InheritanceType All
    Add-ADPermission -Identity "HR" -User “HR group” -AccessRights ExtendedRight -ExtendedRights "Send As"
    And what do you mean Inbox Permission? We usually use the
    Add-MailboxFolderPermission cmdlet to manage folder-level permissions within a user’s mailbox.
    Best Regards.
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact [email protected]
    Lynn-Li
    TechNet Community Support

  • My Default Website Folder & Manage Sites info Not Appearing

    The pop up box on the right with the Files, Assets, and Snippets has somehow changed my default "AAA_WebSite" folder under the Files tab to show "Computer." I can still drill down to the correct folder, but since it's not set to the correct folder, all my "Manage Sites" info is missing as well.
    Any thoughts?

    The pop up box on the right with the Files, Assets, and Snippets has somehow changed my default "AAA_WebSite" folder under the Files tab to show "Computer." I can still drill down to the correct folder, but since it's not set to the correct folder, all my "Manage Sites" info is missing as well.
    If you're referring to what I think you're referring to, that's the Site Manager dropdown box where you can quick jump between sites in DW and select which site you want to work on.
    Click the box (where it says Computer) and select "AAA_WebSite" from the dropdown menu.
    If I've mis-understood, feel free to repost.

  • Manage Sites - How to define skeleton

    Hi all,
    My apologies if this has already been answered, I just can't
    find it, and googled all day today to find a solution, so you guys
    are my last resort.
    I do like the Manage Sites option, and use it quite
    extensively (Win/Mac Platform). Now I would like to be able to
    specify a default folder structure to be created everytime I create
    a new Site. Basically cutting out the middleman, creating the
    folder structure first in Windows Exploder and then having to go
    back to dreamweaver and pointing to the 'doc root', is quite
    repetative.
    If I recall it correctly, the New Site Manager creates by
    default just the docroot, and if specified the images folder. Is
    there a way to have a predefined folderstructure created, everytime
    I create a new Site with Site Manager ?
    I simply refuse to believe that Adobe / Macromedia overlooked
    such a useful feature.
    Any help or pointers to plugins is greatly appreciated
    Windows / Mac : Dreamweaver CS3
    Thanks

    > Now I would like to be able to specify a default folder
    structure to
    > be created everytime I create a new Site.
    Can't be done.
    > If I recall it correctly, the New Site Manager creates
    by default just the
    > docroot
    It doesn't create anything. You do.
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    ==================
    "BlueNC" <[email protected]> wrote in
    message
    news:g66i3h$6fp$[email protected]..
    > Hi all,
    > My apologies if this has already been answered, I just
    can't find it, and
    > googled all day today to find a solution, so you guys
    are my last resort.
    > I do like the Manage Sites option, and use it quite
    extensively (Win/Mac
    > Platform). Now I would like to be able to specify a
    default folder
    > structure to
    > be created everytime I create a new Site. Basically
    cutting out the
    > middleman,
    > creating the folder structure first in Windows Exploder
    and then having to
    > go
    > back to dreamweaver and pointing to the 'doc root', is
    quite repetative.
    > If I recall it correctly, the New Site Manager creates
    by default just the
    > docroot, and if specified the images folder. Is there a
    way to have a
    > predefined folderstructure created, everytime I create a
    new Site with
    > Site
    > Manager ?
    > I simply refuse to believe that Adobe / Macromedia
    overlooked such a
    > useful
    > feature.
    > Any help or pointers to plugins is greatly appreciated
    > Windows / Mac : Dreamweaver CS3
    >
    > Thanks
    >

  • Manage Sites Dialog Box Screen Redraw Problem

    Using Dreamweaver CS6.0.1 on Mac Mountain Lion 10.8.2. When I open the "Manage Sites" dialog box, certain parts of the box are not visible unless I wave or click my mouse on that portion of the screen. Really sick of this. Also text entry into design view in Dreamweaver is maddeningly slow. I've got a fast Mac Pro with an SSD and 48 GB of RAM. Seriously would like to find the answers to these problems.

    I have Dreamweaver CS6 on a MacBook Air with 4GB of RAM running OS X 10.8.2, and don't experience the problems you relate. However, there are some people on Macs who have been experiencing problems with 100% CPU and slow typing. Apparently these problems have been fixed in the Creative Cloud 12.1 update. If you're not a Creative Cloud subscriber, a fix should be coming shortly. See http://forums.adobe.com/thread/1100065.

Maybe you are looking for