This topic has not yet been rated - Rate this topic

CopySourceUrlInfo Class

Represents the URL of a source item and descriptive text.
This class and its members are reserved for internal use and are not intended to be used in your code.

Namespace:  Microsoft.SharePoint.WebControls
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: No
[AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermissionAttribute(SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
public sealed class CopySourceUrlInfo : FormComponent
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
CopySourceUrlInfo
Description 

The Microsoft.SharePoint.WebControls.CopySourceUrlInfo class inherits from the Microsoft.SharePoint.WebControls.FormComponent class which is the foundational control for form and field rendering controls. The CopySourceUrlInfo class is responsible for displaying the list item copy source based on the current list context, if applicable, in a friendly format. 

CopySourceUrlInfo functions by toggling visibility based on some basic checks, ensuring that the control mode is not SPControlMode.New and the ListItem.CopySource property has a value. Following, the description message will be pooled by using SPResource.GetString in order to get the message:

"This item is a copy of :"

The remaining portion of the message will be constructed using the ListItem.CopySource string property, which provides the URL of the source item from which the current item was copied.

Usage Scenario

The primary usage of ListItem.CopySource is internal since the message is displayed when working the default list architecture. However, when developing custom applications that will take advantage of the copying, it is helpful to display as an informative message for users.

In the below, I am creating a new CopySourceUrlInfo object, and providing it a unique indentifier by asssigning the CopySourceUrlInfo.ID property. Following, I am adding the control to the current instance control collection.

C# Code Example

protected override void CreateChildControls()
{
CopySourceUrlInfo info = new CopySourceUrlInfo();
info.ID = "info";
Controls.Add(info);
}

Visual Basic .NET Code Example

Protected Overloads Overrides Sub CreateChildControls()
Dim info As New CopySourceUrlInfo()
info.ID = "info"
Controls.Add(info)
End Sub

Adam Buenz
SharePoint Foundation MVP - http://www.sharepointsecurity.com