2011년 4월 4일 월요일

Your search cannot be completed because this site is not assigned to an indexer.

증상

Search 서비스에 API를 통해 검색을 할 때 제목과 같은 에러가 발생 하는 경우 입니다.

image

원인

Search설정에는 문제없이 되는 것 처럼 보이는데요 이럴 땐 일단 Conent DB의 Search 서버 설정이 제대로 되어 있는지 확인 해야 합니다.

해결

Central Administratoion > Application Management > Manage content database >

image

만약 “Searh Server” 설정이 비활성화 되어 있으면 Central Administration > System Settings > Manage services on server 에서 SharePoint Foundation Help Searh 서비스가 제대로 시작되어 있는지 확인 해 보시기 바랍니다.

2011년 4월 3일 일요일

Field Name, InternalName, StaticName, DisplayNane, _x0020_

Custom Field정의에 대해서 알아 보겠습니다.

Custom Field를 정의 할 때 필수 attribute는 Name, Type, ID 입니다.

ID는 “{}”로 둘러 싸인 GUID값이고, Type은 SharePoint에서 사용 가능한 Type입니다.

MSDN의 File element reference

<Field ID="{1511BF28-A787-4061-B2E1-71F64CC93FD5}"
Name="DateOpened"
DisplayName="Date Opened"
Type="DateTime"
Format="DateOnly"
Required="FALSE"
Group="Financial Columns">
<Default>[today]</Default>
</Field>

Field를 customize할 때 가장 유의 해야 할 부분은 바로 Name 속성입니다.


Name


Name은 SPField 개체를 통해 InternalName 속성로 노출 하는 값으로써 Site내에서 Unique 하고 0-9 숫자와 알파벳 글자만을 사용 할 수 있습니다. 만약 다른 캐릭터가 오면 _x0000_ 형태로 인코딩을 해버립니다. 즉, “File Type” 이라는 이름은 “File_x0020_Type”으로 바꾸는 것이죠. 이건 한글 필드이름일 때는 더욱 문제가 됩니다. 디코딩을 해보기 전까지는 전혀 어떤 글자인지 모를 이름이 “InternalName”에 들어가 있는 것입니다. 그리고 마지막으로 주의해야 할 것은 이름의 글자수가 32자리 라는 것입니다. 이상 넘어가는 글자는 그냥 잘라 먹습니다.


StaticName


StaticName은 별도로 지정하지 않으면 Name 값이 동일하게 들어 갑니다. InternalName은 읽기 전용이라 field 생성 후 변경이 불가능 하지만 이 StaticName은 API를 통해 변경이 가능합니다. 이 속성은 SPFieldCollection.GetField()  메서드에서 해당 field를 찾아 올 때 InternalName과 함께 사용 할 수 있습니다.


image


DisplayName


DisplayName은 UI에서 노출 되는 field 이름입니다. 당연히 공백을 포함 모든 캐릭터를 사용 할 수 있습니다.


결론


Name 속성은 무조건 공백없는 알파벳, 숫자로 만들어야하고 32자를 넘지 말아야 합니다. StaticName은 별도록 지정 말고 Name과 같이 사용하는 것이 좋습니다.

2011년 4월 1일 금요일

the field with ID defined in feature was found in the current site collection or in a sub site

증상

VS에서 Field를 배포 하려 할 때 첫번째엔 문제가 없는데 두번째 부터 아래와 같이 에러가 나면서 Feature Activation에 실패 하는 경우가 있습니다.

‘Error occurred in deployment of step ‘Activate Features’: the field with ID <New GUID> defined in feature <FeatureGUID> was found in the current site collection or in a sub site.

원인

원인은 Field 선언시에 ID값을 선언 할 때 "{}” 로 둘러 싸지 않아서 그렇습니다.

<Field ID="A409C79A-F1C3-43B9-A602-160FF81E0AF8" Name="UserID" Type="Text" />
VS의 버그에 가깝습니다.

해결

해결 책은 일단 ID값을 “{}”로 감싸고 해당 솔루션 패키지를 Retract(취소)한 후 VS를 다시 켠 후 다시 Deploye(배포) 하면 해결 됩니다.

참고

http://support.microsoft.com/kb/2022443

2011년 2월 9일 수요일

SharePoint 2010 Form Based Authentication 및 Custom Login Page

SharePoint 2010 에서 FBA를 구성 하는 방법과 Custom Login Page를 만드는 방법을 정리 해 봤습니다.

1. 중앙 관리 사이트 Membership, Role Provider설정하기

중앙 관리 사이트 web.config 파일을 열어 아래와 같이 추가 하여 수정한다.

<configuration />안쪽에

<connectionStrings>

<add name="SQLConnectionString" connectionString="data source=SQLServerName;Integrated Security=SSPI;Initial Catalog=aspnetdb" />

</connectionStrings>

<system.web></system.web> 사이에

<roleManager defaultProvider="AspNetWindowsTokenRoleProvider" enabled="true" cacheRolesInCookie="false">

<providers>

<add connectionStringName="SQLConnectionString" applicationName="/" description="Stores and retrieves roles from SQL Server" name="SQL-RoleManager" type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />

</providers>

</roleManager>

<membership defaultProvider="SQL-MembershipProvider">

<providers>

<add connectionStringName="SQLConnectionString" passwordAttemptWindow="5" enablePasswordRetrieval="false" enablePasswordReset="false" requiresQuestionAndAnswer="true" applicationName="/" requiresUniqueEmail="true" passwordFormat="Hashed" description="Stores and Retrieves membership data from SQL Server" name="SQL-MembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />

</providers>

</membership>

아래와 같이 "PeoplePickerWildcards" 노드를 찾아 추가한다.

<PeoplePickerWildcards>

<clear />

<add key="AspNetSqlMembershipProvider" value="%" />

<add key="SQL-MembershipProvider" value="%" />

</PeoplePickerWildcards>

2. Security Token Service Membership, Role Provider설정하기

STS서비스의 web.config 파일은

%programfiles%\common files\Microsoft Shared\web server extensions\14\WebServices\SecurityToken 에 있음.

<configuration />안쪽에

<connectionStrings>

<add name="SQLConnectionString" connectionString="data source=SQLServerName;Integrated Security=SSPI;Initial Catalog=aspnetdb" />

</connectionStrings>

<system.web>

<roleManager defaultProvider="c" enabled="true" cacheRolesInCookie="false">

<providers>

<add name="c" type="Microsoft.SharePoint.Administration.Claims.SPClaimsAuthRoleProvider, Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />

<add connectionStringName="SQLConnectionString" applicationName="/" description="Stores and retrieves roles from SQL Server" name="SQL-RoleManager" type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />

</providers>

</roleManager>

<membership defaultProvider="i">

<providers>

<add name="i" type="Microsoft.SharePoint.Administration.Claims.SPClaimsAuthMembershipProvider, Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />

<add connectionStringName="SQLConnectionString" passwordAttemptWindow="5" enablePasswordRetrieval="false" enablePasswordReset="false" requiresQuestionAndAnswer="true" applicationName="/" requiresUniqueEmail="true" passwordFormat="Hashed" description="Stores and Retrieves membership data from SQL Server" name="SQL-MembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />

</providers>

</membership>

</system.web>

3. ASPNET Membership DB설치

1. SharePoint 2010 서버에서 명령 프롬프트를 연다.

2. C:\Windows\Micrsooft .Net\Framework64\v2.0.50727 폴더로 이동

3.  “aspnet_regsql.exe” 실행. 실행 하면 아래와 같은 마법사가 나옴.

clip_image002

clip_image004

Database 이름을 <default>로 놓고 진행하면 "aspnetdb" 라는 멤버쉽 db가 생성됨.

4. Aspnetdb에 SharePoint Service Application Pool 계정이 읽고 쓰기 권한을 할당 함.

clip_image006

4. Web Application 생성

Form Based Authentication을 지원하는 Web Application을 아래와 같이 생성한다.

1. 중앙 관리사이트를 연다.

2. 응용프로그램 관리 아래의 웹 응용프로그램 관리 클릭

3. 리본 메뉴의 "new" 클릭

4. 페이지 상단 Claims based Authentication 선택

a. Claims Based Authentication 선택

clip_image007[6]

a. Host Header와 Port 지정

clip_image009

c. 익명 인증 설정

clip_image010[6]

d. \Membership Provider와 Role Provider 이름 설정

clip_image012

e. Custom Sign In Page 지정

clip_image013[6]

f. Contents Database이름 변경

clip_image014[6]

g. Save를 눌러 실행한다.

clip_image015[6]

5. 사이트 모음 생성하기.

a. 앞서 실행 결과 화면에서 "Create Site Collection"을 클릭

clip_image017

b. 창을 닫았다면 응용 프로그램 관리 클릭 후 사이트 모음 생성 클릭

clip_image018[6]

c. 웹 응용프로그램 선택 확인

clip_image019[6]

d. 사이트 제목과 템플릿 지정

clip_image021

e. 사이트 관리자 지정

clip_image023

f. OK버튼을 눌러 생성완료

clip_image024

5. 생성된 Web Application web.config 수정

C:\inetpub\wwwroot\wss\VirtualDirectories\ 아래에서 생성한 Web Application 폴더내의 web.config 파일을 연다.

clip_image026

<configuration />안쪽에

<connectionStrings>

<add name="SQLConnectionString" connectionString="data source=SQLServerName;Integrated Security=SSPI;Initial Catalog=aspnetdb" />

</connectionStrings>

<system.web></system.web> 사이에

<roleManager defaultProvider="c" enabled="true" cacheRolesInCookie="false">

<providers>

<add name="c" type="Microsoft.SharePoint.Administration.Claims.SPClaimsAuthRoleProvider, Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />

<add connectionStringName="SQLConnectionString" applicationName="/" description="Stores and retrieves roles from SQL Server" name="SQL-RoleManager" type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />

</providers>

</roleManager>

<membership defaultProvider="i">

<providers>

<add name="i" type="Microsoft.SharePoint.Administration.Claims.SPClaimsAuthMembershipProvider, Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />

<add connectionStringName="SQLConnectionString" passwordAttemptWindow="5" enablePasswordRetrieval="false" enablePasswordReset="false" requiresQuestionAndAnswer="true" applicationName="/" requiresUniqueEmail="true" passwordFormat="Hashed" description="Stores and Retrieves membership data from SQL Server" name="SQL-MembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />

</providers>

</membership>

아래와 같이 "PeoplePickerWildcards" 노드를 찾아 추가한다.

<PeoplePickerWildcards>

<clear />

<add key="AspNetSqlMembershipProvider" value="%" />

<add key="SQL-MembershipProvider" value="%" />

</PeoplePickerWildcards>

Command Prompt에서 IISRESET 이후 사이트를 연다.

clip_image028

clip_image030

clip_image032

2011년 1월 16일 일요일

Web Part Error: UnsafeControlException

WebPart Provisioning이 잘 되지 않고 아래와 같은 에러가 화면에 나오는 경우가 있습니다.

 
 

Web Part Error: A Web Part or Web Form Control on this Page cannot be displayed or imported. You don't have Add and Customize Pages permissions required to perform this action.

Hide Error Details

[UnsafeControlException: A Web Part or Web Form Control on this Page cannot be displayed or imported. You don't have Add and Customize Pages permissions required to perform this action.]

  at Microsoft.SharePoint.WebPartPages.WebPartImporter.CreateWebPart(Boolean clearConnections)

  at Microsoft.SharePoint.WebPartPages.WebPartImporter.Import(SPWebPartManager manager, XmlReader reader, Boolean clearConnections, Uri webPartPageUri, SPWeb spWeb)

  at Microsoft.SharePoint.WebPartPages.SPWebPartManager.CompressWebPartNoSave(Boolean isClosed)

 
 

원인은 Anonymous가 설정 된 사이트인 경우 사이트 최초 시작 시에 anonymous로 바로 연결 하게 되면 WebPart Page내에 Provisioning된 webpart를 제대로 불러오지 못해서 그런 것 같습니다.

사이트 편집권한이 있는 사용자로 로그인 후 다시 anonymous로 접근하면 해결 되더군요.