SPMobileUtility.GetViewUrl Method (SPList, SPView)

Returns the URL of the specified list view in a mobile Web application.

Namespace:  Microsoft.SharePoint.Utilities
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: No

Syntax

'Declaration
Public Shared Function GetViewUrl ( _
    list As SPList, _
    view As SPView _
) As String
'Usage
Dim list As SPList
Dim view As SPView
Dim returnValue As String

returnValue = SPMobileUtility.GetViewUrl(list, _
    view)
public static string GetViewUrl(
    SPList list,
    SPView view
)

Parameters

Return Value

Type: System.String
A string that contains the URL.

Examples

The follow code shows GetViewUrl() used to set the href property of a Link control. For the full context of the example, see How to: Create a Mobile Adapter.

protected override void CreateControlsForDetailView()
{
    Image iconImage = this.CreateWebPartIcon(WebPartIconLink.LinkToDetailView);
    iconImage.BreakAfter = false;
    this.Controls.Add(iconImage);
    
    Label titleLabel = this.CreateWebPartLabel();
    this.Controls.Add(titleLabel);

    Int16 itemCount = 1;
    foreach (SPListItem item in this.CurrentListItems)
    {
        SPMobileTemplateContainer container = 
            new SPMobileTemplateContainer { List = this.CurrentList, View = this.CurrentView, Item = item};
                                                 
        ITemplate template = SPControlTemplateManager.GetTemplateByName("MobileSimpleViewListItemIterator");
        template.InstantiateIn(container);
        this.Controls.Add(container);

        // Start new line.
        this.Controls.Add(new LiteralText());
        
        if (itemCount++ >= 3)
        {
            Link moreItemLink = new Link 
                                { Text = "more", 
                                  href = SPMobileUtility. GetViewUrl(this.CurrentList, this.CurrentView) };

            this.Controls.Add(moreItemLink);
            break;
        } // end if limit has been reached
    }// end for each item
}

See Also

Reference

SPMobileUtility Class

SPMobileUtility Members

GetViewUrl Overload

Microsoft.SharePoint.Utilities Namespace