문제

이것은 약간 사소한 것처럼 보일지 모르지만 나는 그것을 알아낼 수 없었습니다. 나는 spsite를 열고 그 spsite 아래에서 spweb를 열려고 노력하고 있습니다. 이것은 동일한 사이트 수집/사이트 계층 구조를 갖는 VPC에서 잘 작동하지만 제작시 SPSITE.openWeb (weburl)를 시도 할 때 URL이 유효하지 않다는 예외가 있습니다. URL이 정확하다는 것을 확인했습니다.

코드:

  try
        {
            SPSite scheduleSiteCol = new SPSite(branchScheduleURL);
            lblError.Text += Environment.NewLine + "Site Collection URL: " + scheduleSiteCol.Url;
            SPWeb scheduleWeb = scheduleSiteCol.OpenWeb(branchScheduleURL.Replace(scheduleSiteCol.Url, "")); //<--- Throws error on this line
            SPList scheduleList = scheduleWeb.GetList(branchScheduleURL + "/lists/" + SPContext.Current.List.Title);
            return scheduleList.GetItemById(int.Parse(testID));
        }
        catch (System.Exception ex)
        {
            lblError.Text += Environment.NewLine + ex.ToString();
            return null;
        }

메모:
Branchscheduleurl은 실제로 웹의 URL도 포함하는 전체 URL입니다.

출력 + 예외 :

사이트 수집 URL : https://oursite.com/mocc
System.ArgumentException : 유효하지 않은 URL : /내부 /ScheduLetool. microsoft.sharepoint.openweb (microsoft.sharepoint.spsite.openweb (string strurl)의 microsoft.spsite.openweb에서 moccbranchschedulelistweb.moccbranchschedulelistv3. getconflictlistitem (string nottics schetherl, string) systic. 객체의 인스턴스. moccbranchschedulelistweb.moccbranchschedulelistv3.checkforconflicts (string [] cfcflags1, datetime starttime, datetime endtime, string [] cfcflags2)

메모:
https://oursite.com/mocc/internal/scheduletool 내가 열려고하는 spweb입니다.

내가 분명한 것을 놓치고 있습니까? 모든 도움은 대단히 감사하겠습니다.

감사.

도움이 되었습니까?

해결책

하단의 예제 테이블을 살펴 봅니다 이 페이지.

매개 변수를 OpenWeb () 메소드 (2 번째 행)로 보내지 마십시오.

다른 팁

먼저 "내부"에 대한 SPWEB 객체를 얻으십시오. 그런 다음 해당 및 객체에 대한 서브 웹 SPWebCollection을 가져옵니다. 그로부터 getSubwebsforcurrentuser () 메소드를 사용하여 "scheduletool"의 spweb 객체를 얻으십시오.

사이트 수집 URL은 /mocc라고 표시되어 있으므로 아래의 SPWEB는 /mocc /내부 /스케줄 툴과 같은 것입니다. 그래서 같은 일을하십시오

string webServerRelativeUrl = site.ServerRelativeUrl + "/internal/scheduletool"

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top