• munish9091@gmail.com
  • NEWBIE
  • 0 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies

How can I READ an existing profile's "ProfileObjectPermission" using the metadata api?

 

I can see that I can UPDATE it with code something like that shown below, but it's very hard to update a profile if I can't read it in the first place.

 

Do I really have to get it file the file-based api and parse the XML myself?

 

Thanks

Kerry 

 

PS: Here's the code to update a profile -- but what does the code to read it look like?

 

// Set permissions for a table

ProfileObjectPermissions pop = new ProfileObjectPermissions();

pop.setAllowCreate(true);

...

pop.setTable("Sometable__c");

 

// Connect the permissions to a profile

 

Profile profile = new Profile();
profile.setFullName("Standard");
profile.setObjectPermissions(new ProfileObjectPermissions[]{pop});
// Update the profile
UpdateMetadata[] metadata = new UpdateMetadata[1];
metadata[0].setMetadata(profile);
metadataConnection.update(metadata);