Reading a sharepoint list in C#
I'd like to read a list on a project server site
So I create a list that which called GetUrl
And I just like to read the title of this list
So I write this piece of code:
`string strUrl = "http://site-2016-02:1000/PWA/";
using (SPSite oSite = new SPSite(strUrl))
{
using (SPWeb oWeb = oSite.OpenWeb())
{
SPList list = oWeb.Lists["GetUrl"];
foreach (SPField field in list.Fields)
{
Console.WriteLine(field.Title);
}
}
}
`but I get the following error:
Additional information: The Web application at http://sfd-2013-02:1000/PWA/ could not be found. Verify that you have typed the URL correctly. If the URL should be serving existing content, the system administrator may need to add a new request URL mapping to the intended application.
I don't understand why when I click on the url the project site is showed
So any idea of what I'm doing wrong?
Is there another solution to be able to read a sharepoint list?
Thank you for your feedback
c# sharepoint-list
add a comment |
I'd like to read a list on a project server site
So I create a list that which called GetUrl
And I just like to read the title of this list
So I write this piece of code:
`string strUrl = "http://site-2016-02:1000/PWA/";
using (SPSite oSite = new SPSite(strUrl))
{
using (SPWeb oWeb = oSite.OpenWeb())
{
SPList list = oWeb.Lists["GetUrl"];
foreach (SPField field in list.Fields)
{
Console.WriteLine(field.Title);
}
}
}
`but I get the following error:
Additional information: The Web application at http://sfd-2013-02:1000/PWA/ could not be found. Verify that you have typed the URL correctly. If the URL should be serving existing content, the system administrator may need to add a new request URL mapping to the intended application.
I don't understand why when I click on the url the project site is showed
So any idea of what I'm doing wrong?
Is there another solution to be able to read a sharepoint list?
Thank you for your feedback
c# sharepoint-list
add a comment |
I'd like to read a list on a project server site
So I create a list that which called GetUrl
And I just like to read the title of this list
So I write this piece of code:
`string strUrl = "http://site-2016-02:1000/PWA/";
using (SPSite oSite = new SPSite(strUrl))
{
using (SPWeb oWeb = oSite.OpenWeb())
{
SPList list = oWeb.Lists["GetUrl"];
foreach (SPField field in list.Fields)
{
Console.WriteLine(field.Title);
}
}
}
`but I get the following error:
Additional information: The Web application at http://sfd-2013-02:1000/PWA/ could not be found. Verify that you have typed the URL correctly. If the URL should be serving existing content, the system administrator may need to add a new request URL mapping to the intended application.
I don't understand why when I click on the url the project site is showed
So any idea of what I'm doing wrong?
Is there another solution to be able to read a sharepoint list?
Thank you for your feedback
c# sharepoint-list
I'd like to read a list on a project server site
So I create a list that which called GetUrl
And I just like to read the title of this list
So I write this piece of code:
`string strUrl = "http://site-2016-02:1000/PWA/";
using (SPSite oSite = new SPSite(strUrl))
{
using (SPWeb oWeb = oSite.OpenWeb())
{
SPList list = oWeb.Lists["GetUrl"];
foreach (SPField field in list.Fields)
{
Console.WriteLine(field.Title);
}
}
}
`but I get the following error:
Additional information: The Web application at http://sfd-2013-02:1000/PWA/ could not be found. Verify that you have typed the URL correctly. If the URL should be serving existing content, the system administrator may need to add a new request URL mapping to the intended application.
I don't understand why when I click on the url the project site is showed
So any idea of what I'm doing wrong?
Is there another solution to be able to read a sharepoint list?
Thank you for your feedback
c# sharepoint-list
c# sharepoint-list
asked Nov 28 '18 at 21:00
ToxicboumboumToxicboumboum
56
56
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
SPSite represents a Site Collection and most likely PWA is a subsite.
string strUrl = "http://site-2016-02:1000";
using (SPSite oSite = new SPSite(strUrl))
{
using (SPWeb oWeb = oSite.RootWeb.OpenWeb("PWA"))
or
string strUrl = "http://site-2016-02:1000";
using (SPSite oSite = new SPSite(strUrl))
{
using (SPWeb oWeb = oSite.RootWeb.Webs["PWA"])
add a comment |
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53528013%2freading-a-sharepoint-list-in-c-sharp%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
SPSite represents a Site Collection and most likely PWA is a subsite.
string strUrl = "http://site-2016-02:1000";
using (SPSite oSite = new SPSite(strUrl))
{
using (SPWeb oWeb = oSite.RootWeb.OpenWeb("PWA"))
or
string strUrl = "http://site-2016-02:1000";
using (SPSite oSite = new SPSite(strUrl))
{
using (SPWeb oWeb = oSite.RootWeb.Webs["PWA"])
add a comment |
SPSite represents a Site Collection and most likely PWA is a subsite.
string strUrl = "http://site-2016-02:1000";
using (SPSite oSite = new SPSite(strUrl))
{
using (SPWeb oWeb = oSite.RootWeb.OpenWeb("PWA"))
or
string strUrl = "http://site-2016-02:1000";
using (SPSite oSite = new SPSite(strUrl))
{
using (SPWeb oWeb = oSite.RootWeb.Webs["PWA"])
add a comment |
SPSite represents a Site Collection and most likely PWA is a subsite.
string strUrl = "http://site-2016-02:1000";
using (SPSite oSite = new SPSite(strUrl))
{
using (SPWeb oWeb = oSite.RootWeb.OpenWeb("PWA"))
or
string strUrl = "http://site-2016-02:1000";
using (SPSite oSite = new SPSite(strUrl))
{
using (SPWeb oWeb = oSite.RootWeb.Webs["PWA"])
SPSite represents a Site Collection and most likely PWA is a subsite.
string strUrl = "http://site-2016-02:1000";
using (SPSite oSite = new SPSite(strUrl))
{
using (SPWeb oWeb = oSite.RootWeb.OpenWeb("PWA"))
or
string strUrl = "http://site-2016-02:1000";
using (SPSite oSite = new SPSite(strUrl))
{
using (SPWeb oWeb = oSite.RootWeb.Webs["PWA"])
answered Nov 29 '18 at 2:19
Mike Smith - MCT - MVPMike Smith - MCT - MVP
59258
59258
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53528013%2freading-a-sharepoint-list-in-c-sharp%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
