SP2010: How to get url to Announcements list item?

Posted on 2012-08-30
Last Modified: 2012-09-04
Hello. I am creating a simple Visual WebPart that reads data from announcements list. I can read announcement list with:

SPSiteDataQuery dataQuery = new SPSiteDataQuery();
 dataQuery.Webs = "<Webs Scope=\"SiteCollection\">";
 dataQuery.Lists = "<Lists ServerTemplate=\"104\" />";

 dataQuery.ViewFields = string.Concat(
  "<FieldRef Name=\"Modified\"/>", "<FieldRef Name=\"Title\"/>", "<FieldRef Name=\"Body\"/>");
 dataQuery.Query = "<Where><IsNotNull><FieldRef Name=Title/>

SPWeb w = site.OpenWeb();
//dtable = web.GetSiteData(dataQuery);
dtable = w.GetSiteData(dataQuery);


Open in new window

But ... How can I get an URL of actual announcement?
Question by:tolppa
    1 Comment
    LVL 1

    Accepted Solution

    I solved my problem. Seems like I cannot get SPListItem with SPSiteDataQuery.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Hire Top Freelancers to Complete C# Projects

    Source the talented Expert Exchange community
    for top quality work on your C# projects.

    Hire the best. Collaborate easily. Get quality work.

    Note:  There are two main ways to deploy InfoPath forms:  Server-side and directly through the SharePoint site.  Deploying a server-side InfoPath form means the form is approved by the Administrator, thus allowing greater functionality in the form. …
    There is one common problem that all we SharePoint developers share: custom solution deployment. This topic can't be covered fully in this short article, so all I want to do in this one is to review it from a development-to-operations perspectiv…
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

    758 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now