IUccPresenceContactCardInstance.RemoveUrl Method
This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.
Removes a URL from this contact card.
Namespace: Microsoft.Office.Interop.UccApi
Assembly: Microsoft.Office.Interop.UccApi (in microsoft.office.interop.uccapi.dll)
Syntax
'Declaration
Sub RemoveUrl ( _
pUrl As UccPresenceContactCardUrl _
)
void RemoveUrl (
UccPresenceContactCardUrl pUrl
)
void RemoveUrl (
UccPresenceContactCardUrl^ pUrl
)
void RemoveUrl (
UccPresenceContactCardUrl pUrl
)
function RemoveUrl (
pUrl : UccPresenceContactCardUrl
)
Parameters
- pUrl
A value of the IUccPresenceContactCardUrl* (UccPresenceContactCardUrl, for a .NET application) type.
Remarks
This method removes the Url represented by the pUrl
paramter from the url collection. An Url collection can hold a single url of a given UCC_CONTACT_CARD_URL_TYPE type. If an application method is passed an enumeration of the contact card type, it can get the corresponding IUccPresenceContactCardUrl instance out of the collection and pass that obtained instance to the RemoveUrl method.
Win32 COM/C++ Syntax
HRESULT RemoveUrl
(
IUccPresenceContactCardUrl* pUrl
);
Note
In a Win32 application, the return value of a method or property is always an HRESULT value indicating the status of the call to the interface member. Any result of the operation is returned as a parameter marked with the [out, retval] attribute. In contrast, in a .NET application the HRESULT value indicating an error condition is returned as a COM exception and the [out, retval] parameter becomes the return value. For the UCC API-defined HRESULT values, see Trace and Handle Errors in Unified Communications Client API.
Example
The following example method accepts a string representing the type of Url to remove from a contact card Url collection. Using the passed string, the method finds the corresponding Url instance in the collection. Finally, the Url instance is removed from the collection. The example method is drawn from an application class that wraps an instance of IUccPresenceContactCardInstance (this._ContactCard
). An advantage of this method signature is that calling code does not have to include a reference to the Microsoft.Office.Interop.UccApi
namespace.
/// <summary>
/// Removes an Url from a presence contact card instance url collection
/// </summary>
/// <param name="pUrlType">string url type</param>
/// <returns>boolean true or fals indicating success or otherwise</returns>
public Boolean RemoveUrlObject(string pUrlType)
{
Boolean returnValue = false;
UccPresenceContactCardUrl urlToRemove = null;
switch (pUrlType.ToLower())
{
case "other":
urlToRemove = this.GetUrlObject(
UCC_CONTACT_CARD_URL_TYPE.UCCCCUT_OTHER);
break;
case "sharepoint":
urlToRemove = this.GetUrlObject(
UCC_CONTACT_CARD_URL_TYPE.UCCCCUT_SHAREPOINT);
break;
case "voicemail":
urlToRemove = this.GetUrlObject(
UCC_CONTACT_CARD_URL_TYPE.UCCCCUT_VOICEMAIL);
break;
case "unknown":
urlToRemove = this.GetUrlObject(
UCC_CONTACT_CARD_URL_TYPE.UCCCCUT_UNKNOWN);
break;
}
try
{
this._ContactCard.RemoveUrl(urlToRemove);
returnValue = true;
}
catch
{
}
return returnValue;
}
/// <summary>
/// Iterate on an Url collection to find an Url object matching the
/// passed Url type
/// </summary>
/// <param name="urlType">UCC_CONTACT_CARD_URL_TYPE type to find</param>
/// <returns>mathing UccPresenceContactCardUrl</returns>
public UccPresenceContactCardUrl GetUrlObject(UCC_CONTACT_CARD_URL_TYPE urlType)
{
UccPresenceContactCardUrl returnValue = null;
foreach (UccPresenceContactCardUrl Url in this._ContactCard.Urls)
{
if (Url.Type == urlType)
{
returnValue = Url;
break;
}
}
return returnValue;
}
Thread Safety
All public static (Shared in Visual Basic) members of this type are thread-safe. Instance members are not guaranteed to be thread-safe.
Platforms
Development Platforms
Windows XP Professional with Service Pack 2 (SP2), Windows Server 2000 with Service Pack 4, Windows Server 2003, Windows Vista Ultimate Edition, Windows Vista Business Edition, Windows Vista Enterprise Edition
Target Platforms
See Also
Reference
IUccPresenceContactCardInstance Interface
IUccPresenceContactCardInstance Members
Microsoft.Office.Interop.UccApi Namespace