本文介绍了得到DispForm.aspx?ID =的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在编写一个powershell脚本,将列表项目从一个列表复制到另一个列表,该部分是gose pretty很容易,但在目的地列表的一列,我需要链接到源列表一个collone项目表单,表单网站看起来基本上像这样  https://spf2013/dvs2/Lists/sourcelits/DispForm.aspx?ID = 1


我可以通过powershell脚本获取问题源项目  =并将其写入目标列表的相应列:


到目前为止我得到了什么:


  Add-PSSnapin" Microsoft.SharePoint.PowerShell"

$ web = Get-SPWeb -identity" https:// spf2013 / dvs2 /"

$ list1 = $ web.Lists [" Source list"]

$ list2 = $ web.Lists [" Destenation lis t"]



$ formurl =" https://spf2013/dvs2/Lists/sourcelist/DispForm.aspx?ID ="

$
$ items = $ list1.items 



foreach($ item in $ items){



    $ newitem = $ list2.items.Add()

    $ newitem [" column1"] = $ item [" column1"]

    $ newitem [" column2"] = $ item [" column2"]

    $ newitem [" column3"] = $ item [" column3"]

    $ newitem [" column4"] = $ web.Lists [" Source list"]

$ newitem [" URL to source list form"] =" $ formurl,
源列表表单的网址 "

$
    $ newitem.update()

}


如脚本所示,我可以在目的地列表中添加链接  $ formurl,但仅限于https:// spf2013 /dvs2/Lists/sourcelist/DispForm.aspx?ID=所以我需要为每个列表项对应的源列表条目自动更改ID。


任何人都有一些想法如何这样做?



解决方案



Hi,

I am writeing a a powershell script that copys list items form one list to another, that part gose pretty easy, but at one column of the destination list I need to have a link to source lists one collone items form, the forms site looks basicly like this https://spf2013/dvs2/Lists/sourcelits/DispForm.aspx?ID=1

The question can I get the powershell script to get the source items DispForm.aspx?ID= and write it to corresponding column of the destination list:

What I got so far:

 Add-PSSnapin "Microsoft.SharePoint.PowerShell"

$web = Get-SPWeb -identity "https://spf2013/dvs2/"
$list1 = $web.Lists["Source list"]
$list2 = $web.Lists["Destenation list"]

$formurl = "https://spf2013/dvs2/Lists/sourcelist/DispForm.aspx?ID="

$items = $list1.items 

foreach ($item in $items) {

    $newitem=$list2.items.Add()
    $newitem["column1"] = $item["column1"]
    $newitem["column2"] = $item["column2"]
    $newitem["column3"] = $item["column3"]
    $newitem["column4"] = $web.Lists["Source list"]
$newitem["URL to source list form"] = "$formurl , URL to source list form"

    $newitem.update()
}

As the script shows I can add a link $formurl to the destination list but only https://spf2013/dvs2/Lists/sourcelist/DispForm.aspx?ID= so I need to get the Id to change automatically for every listitems corresponding source list entry.

Dose any one have some ideas on how to do this?

解决方案




这篇关于得到DispForm.aspx?ID =的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-27 23:56