Sharepoint 2010 设置Sharepoint文件字段属性

Sharepoint 2010 设置Sharepoint文件字段属性,sharepoint-2010,Sharepoint 2010,在我们的SP站点中,我们有一个包含文件的库。这些是与用户关联的文件。现在,我们对用户的配置文件进行了压缩,以接受文件列表。现在,对于用户配置文件中的文件列表,我们想添加一个对该文件的引用,这样用户就不必再次上传 当前库: /个人/我的/用户文件/[文件名] 我想知道怎么做?新用户文件字段(JSON)中的数据如下所示: 我有一个我迭代过的csv文件。csv文件包含用户名:文件名对 必须从该文件所在位置的SP实例库中获取Id值 Powershell代码: $upAttribute = "UserFi

在我们的SP站点中,我们有一个包含文件的库。这些是与用户关联的文件。现在,我们对用户的配置文件进行了压缩,以接受文件列表。现在,对于用户配置文件中的文件列表,我们想添加一个对该文件的引用,这样用户就不必再次上传

当前库: /个人/我的/用户文件/[文件名]

我想知道怎么做?新用户文件字段(JSON)中的数据如下所示:

我有一个我迭代过的csv文件。csv文件包含用户名:文件名对

必须从该文件所在位置的SP实例库中获取Id值

Powershell代码:

$upAttribute = "UserFiles"
$profile_info = Import-Csv profiles.csv

foreach ($row in $profile_info) {
    $userId = $row.user # User ID
    $fullAdAccount = $adAccount += $userId

    #Check to see if user profile exists
    if ($profileManager.UserExists($fullAdAccount))
    {
        $up = $profileManager.GetUserProfile($fullAdAccount)
        $upAttributeValue += $row.filename # Filename

        # CODE ??????

        $up.Commit()
    }
} 
这就是我所有的数据

谢谢你的帮助


Eric

首先需要将自定义属性添加到用户配置文件中,如下所示:

那么这应该可以帮助你:

$upAttribute = "UserFiles"
$profile_info = Import-Csv profiles.csv

foreach ($row in $profile_info) {
    $userId = $row.user # User ID
    $fullAdAccount = $adAccount += $userId

    #Check to see if user profile exists
    if ($profileManager.UserExists($fullAdAccount))
    {
        $up = $profileManager.GetUserProfile($fullAdAccount)
        $upAttributeValue += $row.filename # Filename

        # CODE ??????

        $up.Commit()
    }
} 
#Get user profile and change the value
$up = $profileManager.GetUserProfile($adAccount)
$up[$upAttribute].Value = $upAttributeValue
$up.Commit()