Change privacy for Property in EditProfile (MySite) Page Prgrammatically only not in Upa?
-
sábado, 14 de abril de 2012 17:17
I want to change the privacy of a property in EditProfile Page from public to private which i have done programmatically.
But it changes the privacy of property in EditProfile Page as well as in upa also.
Can it possible to change the privacy only in editprofile page and that change not reflected in upa?
And i want to do this programmatically.
Any support from you all!!!
- Editado ATEET AGARWAL sábado, 14 de abril de 2012 17:22 forgot to express all the situation
- Editado ATEET AGARWAL sábado, 14 de abril de 2012 17:24
Todas las respuestas
-
domingo, 15 de abril de 2012 12:03The edit profile page simply reflects the actual setting in the User Profile so there is no way to have a different setting in UPA then you have in the edit profile page. Could you describe what you are trying to accomplish? Its not clear what having a different setting would do?
Paul Stork SharePoint Server
MVP Chief SharePoint Architect: Sharesquared
Blog: http://dontpapanic.com/blog
Twitter: Follow @pstork
Please remember to mark your question as "answered" if this solves your problem. -
domingo, 15 de abril de 2012 14:22
I have a property "Ask Me about" in editprofile page whose privacy is "Everyone".
I want to change its privacy to "OnlyMe" which i have done it manually in editprofile page and save it.
After that i see its privacy is not reflected back to upa as upa has privacy "Everyone" and in editprofile page it is "OnlyMe".
So i want to this programmatically.
As i try to implement this programmatically but it changes the privacy both in upa and in editprofile page to "OnlyMe".
How to that programmatically so its privacy change to "OnlyMe" in editprofile page and in upa its privacy remain "Everyone"?
-
domingo, 15 de abril de 2012 19:32
The privacy setting in the UPA is the default while the privacy setting on the edit page is for your particualr instance of that property's value. If you change it on the edit profile page you are only changing the value for our property, but if you change it in UPA you are changing the default for everyone. Changing it programmatically in the UPA changes the default for everyone. To programmatically change the privacy as though you did it on the edit profile page you need to retrieve yur profile settings and change the value on your profile, not on the property itself. But to do that for all the users you would need to retrieve each user's profile and make the change to their profile value.
Paul Stork SharePoint Server
MVP Chief SharePoint Architect: Sharesquared
Blog: http://dontpapanic.com/blog
Twitter: Follow @pstork
Please remember to mark your question as "answered" if this solves your problem. -
miércoles, 18 de abril de 2012 15:24
Thanks Paul for info.
But can u tell me how to modify the privacy of a property in editprofile page programmatically.
As, when i do this, it mofify the privacy in upa too so can u post here how to do that programmatically?
-
miércoles, 18 de abril de 2012 18:29
I tested this in a console app this morning. The point is that you have to retrieve the specific user's profile and modify the privacy of the property in that context, not retrieve the properties from the user profile service. Here's the primary piece of code:
SPServiceContext context = SPServiceContext.GetContext(site);
UserProfileManager profileManager = new UserProfileManager(context);
string sAccount = "domain\\user";
UserProfile u = profileManager.GetUserProfile(sAccount);//Updates privacy setting
u[PropertyConstants.HomePhone].Privacy = Privacy.Manager;
u.Commit();Paul Stork SharePoint Server
MVP Chief SharePoint Architect: Sharesquared
Blog: http://dontpapanic.com/blog
Twitter: Follow @pstork
Please remember to mark your question as "answered" if this solves your problem. -
miércoles, 25 de abril de 2012 14:41
Thanks Paul!!! It work for me for most of the property.
But I have a property "SkillSpecialties" which is not coming under u[PropertyConstants.?]
As, at "?" place this (SkillSpecialties) property name is not coming.
where "SkillSpecialties" is internal name of a property.
And its external name is "Skills/Specialties".
Can you tell me how to set the privacy of this property??
And also some property are replicable so i didn't find any condition to check the whether the property is replicable or not ,and how to make true/false for the property replication.
- Editado ATEET AGARWAL miércoles, 25 de abril de 2012 15:21
-
jueves, 26 de abril de 2012 11:11
If SkillSpecialties is a property you created then it won't be in the PropertyConstants class. Thats a built in class with static properties for each of the built in properties. But custom properties won't show up. For those you just need to use a string variable to hold the name of the property.
The property can be made replicable by changing the IsReplicable property of the propertyType object associated with the property.
Paul Stork SharePoint Server
MVP Senior Solutions Architect: BlueChip Consulting Group
Blog: http://dontpapanic.com/blog
Twitter: Follow @pstork
Please remember to mark your question as "answered" if this solves your problem.

