Following on from my previous article on how to modify single value user profile properties in SharePoint 2010 using PowerShell, this script shows how you can modify multi value properties, which are stored in the Keywords term set in the Managed Metadata service application. There is actually not a lot of difference between the two scripts – the only change being the part of the script that modifies the property. The key difference is that this script adds a term to the list of terms already present in the property rather than replacing the value as before.
The example I have used here is to add the term “SharePoint” to the list of skills for the user DOMAIN\phil.childs. If the term is already present in the Keywords term set, then it will retrieve it and add it to the user profile property. If it is not currently in the term set, then it will add it for you before populating the user profile property:
#Set up default variables
$mySiteUrl = "http://mysite"
$adAccount = "DOMAIN\phil.childs"
$upAttribute = "SPS-Skills"
$upAttributeValue = "SharePoint"#Get site objects and connect to User Profile Manager service
$site = Get-SPSite $mySiteUrl
$context = Get-SPServiceContext $site
$profileManager = New-Object Microsoft.Office.Server.UserProfiles.UserProfileManager($context)#Check to see if user profile exists
if ($profileManager.UserExists($adAccount))
{
#Get user profile
$up = $profileManager.GetUserProfile($adAccount)
$up[$upAttribute].Add($upAttributeValue)
$up.Commit()
}
else
{
write-host "Profile for user"$adAccount "cannot be found"
}#Dispose of site object
$site.Dispose()
A few things to note with this script:
- Make sure you have the correct permissions configured on the User Profile Service Application (see previous article for details)
- As before, you will need to specify the My Site host site collection URL for the $mySiteUrl variable
- You have to use the internal name of the user profile property when assigning the $upAttribute variable – e.g., “SPS-Skills” for the Skills property – this is also the same for single value properties, too (forgot to mention this in my previous article). You can find the internal name of a property by going to the Manage User Properties page of the User Profile Service Application and editing a property
Along with adding terms to a multi value user profile property, you may also want to remove them. You can do this by using the same script above and replacing the $up[$upAttribute].Add($upAttributeValue) line with the following, which cycles through all the terms assigned to the user profile property and removes the term you have specified once found:
for ( [int]$i = 0; $i -lt $up[$upAttribute].Count; $i++ )
{
if ($up[$upAttribute][$i] -eq $upAttributeValue) { $up[$upAttribute].RemoveAt($i) }
}
Finally, if you want to remove ALL terms from the user profile property (e.g., delete all terms from the Skills property for that user), then replace the $up[$upAttribute].Add($upAttributeValue) line with the following:
$up[$upAttribute].Clear()
Thanks for the post.
ReplyDeleteI used some of it as inspiration.
One note: The line
$up[$upAttribute].Add($upAttributeValue)
Will fail if you execute it twice (i.e. for an existing term set value).
Big data is a term that describes the large volume of data – both structured and unstructured – that inundates a business on a day-to-day basis. big data projects for students But it’s not the amount of data that’s important.Project Center in Chennai
DeleteSpring Framework has already made serious inroads as an integrated technology stack for building user-facing applications. Corporate TRaining Spring Framework the authors explore the idea of using Java in Big Data platforms.
Spring Training in Chennai
The new Angular TRaining will lay the foundation you need to specialise in Single Page Application developer. Angular Training
A crap, my bad.
ReplyDeleteMy comment above is only valid if you have bound the multi-valued field to a term set.
Thanks for this it's really useful. One thing that I am struggling with is being able to add multiple values into the multi-value field - e.g. someone has more than one skill (e.g. SharePoint 2007 and SharePoint 2010" how do you pass both through to the UPS via Powershell?
ReplyDelete$myStringFromCSV = "SharePoint 2007; SharePoint 2010; SharePoint 2013"
ReplyDelete$values = $myStringFromCSV.Split(";")
foreach ($value in $values)
{
$up["SPS-Responsibility"].Add($value)
}
$up.Commit()
2015-12-7 xiaozhengm
ReplyDeletefitflops clearance
michael kors uk
tory burch outlet
oakley sunglasses
nike outlet
louis vuitton outlet
louis vuitton pas cher
kate spade outlet
gucci outlet
coach outlet
michael kors outlet
canada goose uk
coach factory outlet
christian louboutin shoes
nike blazer
jordan 8s
michael kors handbags
jordan 3 infrared
caoch outlet
true religion outlet
air jordan uk
michael kors
longchamp outlet
adidas shoes uk
coach factory outlet
coach factory outlet
nike blazers
ugg australia
nike uk
coach factory outlet
tiffany and co
basketball shoes
michael kors outlet uk
louboutin
air jordans
chaussure louboutin
air jordan 13
ugg outlet
louis vuitton outlet
Great Article..
ReplyDeleteOnline DotNet Training
.Net Online Training
Dot Net Training in Chennai
IT Training in Chennai
20160301meiqing
ReplyDeletecoach outlet
christian louboutin outlet
lebron james shoes 12
oakley sunglasses wholesale
jordan retro
nike free run
ray bans
oakley vault
louis vuitton outlet
ray ban sunglasses
hollister
cheap jerseys
kobe 9
ray ban sunglasses
gucci outlet
coach outlet
true religion
uggs outlet
ralph lauren
ralph lauren outlet
louis vuitton
polo outlet
timberland boots
michael kors outlet
michael kors outlet
uggs outlet
abercrombie and fitch
air max 95
uggs outlet
michael kors handbags
giuseppe zanotti sneakers
louis vuitton
nike air max
ray ban sunglasses
oakley sunglasses wholesale
ugg outlet store
michael kors outlet
canada goose outlet
kobe 11
nike huarache
gucci sunglasses uk
ReplyDeletelongchamp pliage
nike air force 1
longchamp handbags
football shirts
tory burch outlet online
cartier watches
jordan pas cher
oakley sunglasses
cheap soccer jerseys
chrome hearts outlet
ralph lauren polo
hermes outlet
true religion jeans
versace sunglasses on sale
michael kors outlet online
ray ban sunglasses
fitflops clearance
rolex watches
cartier outlet store
prada sneakers
chrome hearts outlet
rolex watches
cheap jordans
ralph lauren outlet
tiffany and co
louis vuitton outlet store
ferragamo shoes
polo ralph lauren
dior outlet
cai20160519
20160530meiqing
ReplyDeletepolo outlet
north face jackets
nike free flyknit 4.0
michael kors outlet online
ray-ban sunglasses
ray ban outlet
burberry handbags
nike free run black
cheap nike shoes
prada outlet
coach outlet
michael kors outlet
adidas superstars
tiffany jewelry
coach outlet
tiffany and co
running shoes
polo outlet
nike air max
adidas nmd white
ray ban sunglasses
kate spade outlet
ed hardy uk
pandora charms
armani watches
valentino shoes
coach outlet
true religion
asics outlet
coach outlet online
fake oakleys outlet
kate spade
oakley sunglasses
christian louboutin
nike store
timberland boots
ReplyDeleteray ban sunglasses
louis vuitton handbags
rolex watches
toms shoes
michael kors outlet
air jordan pas cher
instyler curling iron
replica watches
fake watches
replica watches
jordans for sale
coach outlet
louis vuitton handbags
cheap jordan shoes
ralph lauren outlet
michael kors outlet
kate spade
gucci outlet
true religion shorts
christian louboutin outlet
coach outlet
jordans
michael kors outlet clearance
kobe bryant shoes
coach outlet
ray ban wayfarer
michael kors handbags
michael kors handbags
jordan retro
kobe bryant shoes
michael kors outlet online sale
michael kors handbags
coach factory outlet
jordan 8
louis vuitton
christian louboutin shoes
true religion
michael kors handbags
michael kors outlet
20168.8wengdongdong
Thank you - finally got a step in the right way :-)
ReplyDeleteIf the script should loop through all the users MySites and delete e.g. 3 tags - how should the script be extended? (I'm a NOOB to powershell)
new balance shoes
ReplyDeletelouis vuitton
louis vuitton outlet
north face jackets
ysl outlet
prada sunglasses
lacoste pas cher
michael kors handbags
oakley sunglasses
michael kors clearance
chanyuan10.11
instyler
ReplyDeletechaussures louboutin
abercrombie & fitch
oakley sunglasses
ralph lauren uk
mlb jerseys
snapbacks wholesale
nike roshe run
coach outlet
louis vuitton handbags
20173.9chenjinyan
20170327 junda
ReplyDeletelouis vuitton outlet
louis vuitton
oakley sunglasses
ferragamo shoes
gucci outlet
cheap ray ban sunglasses
hermes bags
michael kors outlet stores
oakley sunglasses
gucci outlet
giuseppe zanotti outlet
ReplyDeleteralph lauren polo
oakley sunglasses wholesale
ralph lauren outlet
ray ban sunglasses outlet
valentino outlet
coach outlet
wanglili21070524
coach outlet online
ReplyDeletecoach handbags outlet
prada sunglasses for women
nba jerseys wholesale
michael kors outlet online
mulberry outlet
louis vuitton handbags
oakley sunglasses
cheap football shirts
fitflops uk
chanyuan2017.06.08
With a range of available activities like sailing, swimming, snorkeling, water-sports, trekking, rafting, skiing, climbing, cycling, etc every moment can be a unique experience.have a peek at this web-site
ReplyDeleteIt is great to have visited your website. Thanks for sharing useful information. And also visit my website about health. God willing it will be useful too
ReplyDeleteObat Sakit Dada
Obat Tumor Jinak diatas Bola Mata
Penyebab Benjolan dileher
Obat Penghilang Nyeri Lutut
Obat Penghilang Nyeri Pada Payudara
Obat Luka Bernanah bekas Caesar
3、
ReplyDeletechristian louboutin
birkenstock outlet
ferragamo outlet
fitflops sale clearance
reebok shoes
adidas outlet online
cheap jordans
coach outlet
ferragamo shoes
mowang05-27
his article is very helpful at all thanks
ReplyDeleteObat Penyakit Asam Urat
Obat Mata Juling
Obat Kanker Rahim
Cara Mengobati Sakit Pinggang
Cara Mengobati Benjolan Di Vagina
Pengobatan Alami Penyakit vertigo
The article is very interesting and very understood to be read, may be useful for the people
ReplyDeleteCara Ampuh Mengobati Radang Usus
Pengobatan Hilangkan Batu Kandung Kemih
Obat Untuk Menyembuhkan Disentri
Pengobatan Untuk Mengatasi Radang Panggul
Pengobatan Untuk Menyembuhkan Abses Payudara
given article is very helpful and very useful for my admin, and pardon me permission to share articles here hopefully helped :
ReplyDeleteCara mengatasi mata kering
Obat katup jantung bermasalah
Obat penyakit jantung bawaan
Obat telinga berdengung ampuh
Cara menyembuhkan kolera
Obat benjolan di anus ampuh
Cara menyembuhkan faringitis
Our digital marketing course in Chennai is targeted at those who are desirous of taking advantage of career opportunities in digital marketing. Join the very best Digital Marketing Course in Chennai. Get trained by an expert who will enrich you with the latest digital trends.
ReplyDeleteDigital Marketing Course in Chennai
Digital Marketing Training in Chennai
Online Digital Marketing Training
SEO Training in Chennai
Digital Marketing Course
Digital Marketing Training
Digital Marketing Courses
alat bantu sex wanita penis tempel
ReplyDeleteviberator kapsul getar
alat bantu sex wanita fairy pocket mini
alat pembesar payudara
obat perangsang wanita dh2o
obat perangsang wanita opium spray
obat perangsang wanita blue wizard
obat perangsang wanita
obat perangsang wanita sex drop
obat perangsang wanita potenzol
the article is very petrifying, hopefully it can be useful and an important lesson.
ReplyDeleteCara Mengatasi Penyebab Kekurangan Sel Darah Putih
Obat Epidural Hematoma
Cara Menghilangkan Benjolan Di Telinga
Obat Trombosis Vena Dalam
Bahaya Nyeri Dada
Obat Alami Untuk Bibir Kering
Thank you for sharing an interesting and very useful article. And let me share an article about health here I believe this is useful. Thank you :)
ReplyDeleteCara Mengobati Kencing Nanah (Gonore) dengan Daun
Sirih
Obat Penghancur Kista Ovarium
Obat Nyeri Tumit Tradisional
يلزم ان تهتم جيدا بغسل السجاد وقبل أن تحدث عملية نقله، نقوم بلف السجاد داخل بعضه لأجل أن لا يأخذ منطقة عظيمة ومن الأجود أن يلف السجاد بورق شفاف لأجل أن يتم حفظه من تراكم الأتربة عليه.
ReplyDeleteشركة نقل عفش
شركة نقل اثاث من الرياض الى جدة
شركة نقل عفش من الرياض الى جدة
شركة نقل عفش بجدة
نحن لدينا مجموعة عمل على أعلي مستوي من الخبرة والمهنية فى ميدان إبادة ومكافحة الحشرات المنزلية ، ادارة المؤسسة ادارة قوية حكيمة جعلت من شركتنا المؤسسة الاولي فى جازان فى مكافحة الحشرات والقوارض المنزلية ، بالاضافة الي المهندسيين الذين يجتهدون للوصول الي افضل المبيدات التي تسخدمها مؤسسة بخ الحشرات بجازان للقضاء على الحشرات المنزلية ، كما يبقى لدينا متخصصون بخ الحشرات بالمملكة الفنيين المختصين لرش وابادة الحشرات وخبراء اصتياد الفئران بالبيت والمندوبين الذين يأتون لمعاينة الموضع وفريق استقبال المكالمات جاهو للاستجابة إلى اسئلتكم واستفساراتكم فى اى وقت – لا تترددو بالاتصال بنا هذه اللّحظة .
ReplyDeleteشركة مكافحة حشرات
شركة مكافحة النمل الابيض بجازان
شركة مكافحة حشرات بجازان
شركة رش مبيدات بجازان
No matter what type of Michael Kors Bags Outlet each individual got, they all had one thing in common. We all know that getting something on sale is like winning a mini lottery, but to find a name brand handbag like Michael Kors Black Friday Sale for instance, discounted is like a slice of heaven on earth. I have personally attacked my husband with hugs and kisses when finding Official Coach Outlet Online at discounted prices.
ReplyDeleteMichael Kors Factory Outlet stores can be found in malls all over. MK Outlet and other Coach merchandise can also be found in some boutiques. Inspired by the same material baseball gloves are made from, these Coach Bags On Sale Online are versatile and stylish. Since it's conception, the Michael Kors Handbags Outlet has been produced into a variety of designs, colors, shapes, and styles that have won top pick of millions of women the world over.
New Michael Kors Bags are the most sought after handbag. Since Coach Outlet Online is one of the most recognized name brands in the world of fashion, you will find A-list celebrities down to small girls wearing them.
tags:Coach Outlet|Coach Bags Factory Outlet|Coach Purses Outlet
Find out who was born on any day in any month in history via our calendar of famous birthdays. Includes famous, historical, noteworthy and Celebrity birthdays.
ReplyDelete