问题
I am a COMPLETE beginner when it comes to SharePoint! So, forgive my lack of knowledge. I'm sure the answer to this question is probably in a million different places on the internet somewhere. I trust StackOverflow for the best answer...!
I have a SharePoint site collection that will eventually be an internet site. It is custom branded using HTML master pages and page layouts. So, I want to create a list and use that as an Announcement list. The title will be a link that, when clicked, goes to list item detail page. That part I've created.
But, the list item detail page is NOT branded. It goes to a default styled, internal page that has the details. That I DON'T want. I need to have the detail page look like the rest of the site, using the branding I've already created.
How do I send the details to a page that uses the site's custom branding? I know there are possibly 3 or more methods (dispform.aspx, REST API, web part), but I'm confused about all three.
Thanks in advance.
回答1:
For your use case, the REST API would probably be simplest & still meet your needs. You can fire a simple GET request for the item details then display it however you wish in accordance with your custom UI. Be it loading a custom form page you build or even generating markup based on the GET response and displaying it within, say, a modal DIV or details pane.
The REST call parameters would look like this:
url: http://YourSiteUrl/_api/web/lists/GetByTitle(‘YourListTitle')/items(Item ID)
method: GET
headers:
Authorization: "Bearer " + accessToken
accept: "application/json;odata=verbose" or "application/atom+xml"
Note the accept header so that you can specify whether you want a JSON-based or XML-based output.
MSDN reference on using the REST API: http://msdn.microsoft.com/en-us/library/office/dn292552%28v=office.15%29.aspx
来源:https://stackoverflow.com/questions/23655710/sharepoint-2013-display-the-detail-from-a-list-item-in-a-branded-page-not-the