SPNote

SharePoint Notes

Central Admin Health Analyzer

중앙 관리 사이트를 방문하면 Status Container (Title 아래) 에 Issue 가 있다고 친절히 알려줍니다.. (설정 상에 문제가 있을때 가르쳐주는 걸 보면 좋은 기능이라고 생각함) 이 Issue 를 보기 위해서 링크를 누르면, Central Administration > Monitering Tab > Review problems and solutions 의 위치로 이동합니다.

아무 생각없이 기존의 답습대로 Administrator 를 기준으로 SharePoint 2010 을 설치한 결과 앞으로는 하지 말라는 내용이 많이 포함되어 있습니다.


 # Review Problems and solutions

 

보통은 이런 메시지가 작업에 치명적인 영향을 미치지는 않으므로 무시하고 진행을 하겠지만, 오늘은 문제가 생겨서 짚고 넘어가려고 합니다. 다름이 아니라 Service Unavailable (HTTP Error 503) 이라는 끔찍한 메시지가 나와서 진상조사를 하던 중에 이 영향?을 알게 되었습니다.

 # Service Unavailable

 

Beta 버전이 불안정해서 그런지 하고 의심을 해보았으나 보통은 자신의 책임?이 항상 크기 마련이므로 SharePoint 관련 서비스 점검하던 찰나에 단서를 발견하였습니다. 평소 무거운 관계로 필요 없을 듯해 보이는 서비스들을 모조리 죽여놓았었는데... SPUserCodeV4 서비스를 실행하던 찰나에 아래와 같은 메시지를 발견하였습니다. (Sandboxed Solution 사용하면 필요 많습니다.)

 # Error while starting SPUserCodeV4

 

갑자기 인증 문제가 있다니??? 여튼, 단서를 발견하고 곰곰히 생각을 해보니 좀 전에 재부팅하면서 Administrator 암호를 바꾼 기억이 떠올랐습니다. ㅡㅡ; 여튼, 다시 바꾸고 SQL Server 부터 SharePoint 관련 서비스들을 다시 실행하니 정상적인 페이지를 만날 수 있었습니다. Windows 2008 R2 를 사용 중인데... 암호가 기본적으로 42일만 살수가 있어서 그 이후엔 다시 바꾸게 되어 있더군요... 여튼, Windows 2003 시절처럼 가볍게 바꾸려고 했더니... 바꿀 수 없도록 비활성화가 되어 있었지만 구글링해서 적용하였습니다.  

당연한? 말이기도 하지만, 보안 및 설정 상에 있어서 Administrator 보다는 특정 계정을 생성하여 관리하기를 권장합니다. 오늘은 SharePoint Blog 에서 Enabling a Button on the Ribbon Based on Selection 를 따라하다가 Visual Studio 에서 제공하는 솔루션 관리 기능은 믿을게 못된다는 생각을 고집하면서 재부팅하다가 이런 문제를 만났습니다. 이상하게도 Custom Action 의 커스터마이즈가 잘 안되더군요... 중요한 것은 SDK 를 맹신하고 자료가 눈 앞에 없더라도 주변을 잘 둘러보면 해결이 되는 것 같습니다. 다음은 이 글을 이용하여 간단한 예제를 만들어 보겠습니다.

 

VS2010 편리한 기능 WSP 파일 복원

안녕하세요?

Will 입니다. 이번에는 VS2010 의 편리한 기능이 있어서 소개해 드리도록 하겠습니다 Moss2007을 개발 하셨던 분들은 .WSP파일을 기억

하시고 있을 것이라고 생각 합니다. 그런데 이런 파일들을 VS2010에서 자체적으로 압축을 풀고 Feature단위로 나뉘어서 Solution파일로

복원을 시켜주는 기능이 있습니다. 2007에서 개발 됬던 것들을 2010으로 converting시 매우 유용 하리라고 생각 합니다.

1. VS2010 에서 File -> New -> Project

2. Visual C# -> Sharepoint 0> 2010 -> Import SharePoint Solution Package

3. 배포할 서버 선택 -> Next

4. .wsp파일을 찾아서 선택해 달라는 내용입니다. -> Browser를 선택 해서 해당 파일을 선택

5. 파일을 선택 했으면은 Next

6. .wsp파일의 복원 파일들이 맞는지 체크를 해달라는 내용입니다. 체크를 확인 하고 Finish

7. 완료가 되면은 Success라는 팝업 창이 뜨고 파일들의 복원을 확인 할 수 있습니다.

Moss 2007 백업 복원

안녕하세요?

Will 입니다. 이번에는 예전에 2007에서 백업과 복업시 했던 방법을 소개 하기 위해 쓰도록 하겠습니다.

기본적으로 Moss 2007에서는 stsadm을 사용해서 백업을 하고 복원을 하는 경우가 많습니다.

하지만 이툴로 설정을 하였을 시 에러가 나서 롤백을 하는 경우도 있는데요. 이럴때 참 난감합니다.

이럴때 쓰는 방법인데요. WebPart의 dll 및 파일들을 다 가지고 계시다면은 해당 백업 및 복원이 가능 한데요.

우선 삭제 하시기 전에 12폴더를 백업을 시켜 둡니다. 그리고 해당 필요한 DB (보통 SharePoint_80) 를 백업을 해둡니다.

그리고 복원해야 될 서버에 가서 Moss2007을 설치를 하시고 80으로 WebApplication만 만듭니다. 그리고 나서 사이트 모음을 만들지

마시고 아까 백업한 SharePoint_80.bak을 가지고 DB에 있는 아까 만든 WebApplication의 DB(처음 만드셧다면, SharePoint_80)를 덮어

씌웁니다. 그럼 기존에 있던 데이터들은 전체가 다 복원이 되고요 해당 웹파트 및 Feature들은 직접 기존에 설치 했던 되로 설치를 하면은

해당 사이트의 복원이 완료 됩니다.

궁금한 사항은 메일로 보내주시면은 정성스럽게 답변을 드리도록 하겠습니다.

SharePoint 2010 사용자 권한 EventFiring

안녕하세요?

Will 입니다. 이번에는 다름이 아닌 SharePoint 2007에서 사용 하던 EventFiring에 대해서 쓰도록 하겠습니다.

기본적으로 리스트에 값들을 업데이트를 하고 내용을 채워 넣을 때 EventReceiver를 통해서 값들을 변경 하고 ���데이트를 하고 하는데요.

이런경우 관리자가 아니면은 제약이 많은 경우가 많습니다. 그래서 SharePoint 2007에서는 해당 업데이트시 DisableEventFiring() 함수를 사용해서

권한의 제약을 풀고 업데이트를 하고 나서 EnableEventFiring() 함수를 사용해서 다시 권한의 제약을 활성화 하는 경우가 있는데요. SharePoint2010

에서는 해당 함수가 사라진것은 아닌데 경고창이 뜹니다. 해당 함수를 찾을 수 없다 등등..... 에러를 뿌리지는 않는데 해당 함수가 따로 변경 되었습니다.

 EventFirngEnabled 라는 속성으로 바뀌면서 해당 값에 True, False를 넣어 주면은 됩니다. 예로 들어서

EventFiringEnabled = false;

list.update();

EventFiringEnabled = true;

 

위와 같은 식으로 사용 하시면은 됩니다.

 

BlogEngine Language Pack Maintainers...

지금 사용하고 있는 Blogging Platform 은 BlogEngine.NET 입니다. ASP.NET 용 어플리케이션이 별로 없어서 슬픔에 잠겨 있을 시절에 만난 고마운 App 이었는데 한글 Resource 가 없어서 제출하였는데, 이번 1.5 Version 에 포함되어 있더군요~ 하지만 문제가 있습니다. 이번과는 별개로 다국어 작업을 하면서 알고 있었던 예전부터 알고 있었던 사실!!! "한글 OS 에 Internet Explorer 의 기본 언어는 ko (한글)" 이라는 것을 잠시 망각하고 ko-KR.resx 보낸 실수를 알게 되었습니다. 그래서 이번엔 ko.resx 하나만 보내겠습니다.
  - BlogEngine.NET Article: Attention To Language Pack Maintainers

Windos 2008 Server 에 VS 2008 를 켜고 ASP.NET Development Server 를 통해 잠시 확인을 해보았는데... 이런~~ 깨져서 나옵니다. 인코딩 문제인가 싶어서 구글링해서 전체 파일을 Unicode 인코딩으로, (UTF-8 With Signature) Codepage - 65001  저장했음에도 여전히 깨졌습니다. 좀 더 구글링해보니 VS 의 템플릿 어쩌구저쩌구 했는데... 다음에 시간날때 해결하려고 잠시 미뤘습니다.

어쨌든, 우선은 깔끔하게 Control Panel > Region and Languate > Administrative Tab
  > Change System Locale > Korean (Korea)
로 바꿔주도 재부팅~~ 하고 우선 돌려보고 제출했습니다.
Win 2008 부터 VS 와 문제가 있는건지 잘 모르겠네요~

 

[솔루션 전체 인코딩 적용 방법]
  - PowerShell 로 한번 해보고 싶은 욕망은 있었으나 시간 관계상 윈폼으로 주저없이 이동했습니다.

[code:c#;ln=off]

string path = "PathToApply";

foreach (var f in new DirectoryInfo(path).GetFiles("*.cs", SearchOption.AllDirectories))
{
    string s = File.ReadAllText(f.FullName);
    File.WriteAllText(f.FullName, s, Encoding.UTF8);

    txtStatuses.Text += f.Name + Environment.NewLine;
}

[/code]

 

[Version 1.6 을 위한 Resource 파일]
- Download labels.ko.zip (6.77 kb) for Version 1.6

 

ReGhosting in SharePoint Server 2003 and WSS 2.0

SharePoint 2007 is my first SharePoint exprience and developed for it all the time but I moved to a new company and its Flatform is SharePoint Portal Server 2003 environments... The main reason I moved is a upcoming upgrade for SharePoint 2010.

but I'm frustrating at this moment. ㅠㅠ (crying...)

I was given a simple task which is to edit few javascript lines and I was doing on default.aspx files living in \60\TEMPLATE\1042\SPS??? directories. But SPSSITES directory is different than others and I looked on the url and found a url is different and it is /C9/SiteDirectory/Lists/List/Summary.aspx, not default.aspx.

With my SP 2007 knowledge, the url like /Lists/Summary.aspx means the page is from Database. So I opened the path using Map Network Drive (Open as Web Folder option is disappeared in IE 8) and edited it and the page is worked well. But!!! My colleague asked me how to do that??? She said, it is uncommon way here I want the old way back. I thought if I delete it from Web Folder, the page is coming from local drive again.

As someone SPS 2003 experts expects, a big problem happened!!! The summary.aspx page is gone and AllItems.aspx is displayed. After some walkaournds I could do, I realized nothing I can do at that time cause I'm new for it... I tried copying the Summary.aspx back to Web Folder and create views and ETC... and I started googling on this and found lots of info on Reghosting...

Unfortunately, reghosting is not my solution but I'm here to write on reghosting. I still have the problem to recover... (I'm installing SPS 2003 on my local PC now)
Googling on reghosting, they said "UPDATE Content to NULL from Docs table" and the way worked well. Because the MS has not mentioned on this, you sould use this carefully. One thing I'm a little satifisfied was the GhostHunter is using this way but this updates MetaInfo and MetaInfoSize columns more.

 

Directions are

  1. Connect to the SiteName_SITE database and open the Docs table
  2. Find the unghosted page
  3. Execute a sql statements which is to update Content, MetaInfo, and MetaInfoSize columns to NULL 

The SQL Query I used is

[code:tsql;ln=off]

-- Find Unghosted pages
SELECT SiteId, DirName, LeafName, MetaInfo, MetaInfoSize, Content
FROM Docs
WHERE LeafName = 'default.aspx'

-- Find Unghosted pages2 (If there are lots of records...)
SELECT SiteId, DirName, LeafName, MetaInfo, MetaInfoSize, Content
FROM Docs
WHERE SiteId = '9DAB8065-EA68-4021-BFEA-5A49D63540E2'
AND WebId = '77973AB7-EDB5-4D0E-BD55-17CC1F2C1C48'

-- UPDATE to Re-Ghost
UPDATE Docs
SET Content=NULL, MetaInfo=NULL, Size=0, MetaInfoSize = 13528
WHERE Id = '3BF58ADD-A7B2-4BB9-A255-D4B1FBF4BFE8'

[/code]

 

You need to get the size of file and Site and Web Ids. Main reason I used this is my condition that the docs table contains more than 1.6 million so that it is too slow. Here is the code to get Ids.

[code:c#;ln=off]

SPSite spServer = SPControl.GetContextSite(Context);
SPWeb spWeb = SPControl.GetContextWeb(Context);
Response.Write("Site ID: " + spServer.ID.ToString().ToUpper() + "<br />");
Response.Write("Web ID: " + spWeb.ID.ToString().ToUpper());

[/code]

 

The Columns whose value is chaged are

  1. Size MetaInfoSize
  2. Version
  3. DocFlags
  4. CharSet
  5. TimeLastModified
  6. NextToLastTimeModified
  7. MetaInfoTimeLastModified
  8. TimeLastWritten
  9. VersionCreatedSinceSTCheckout
  10. MetaInfo
  11. Content

 

After I deleted this Summary.aspx file, the record is disappeared and I found that coping the Summary.aspx file to the Web Folder created a new record with new Id. I still have the problem recovering the Summary.aspx. I tried many ways I could do such as set other columns and IISRESET, etc but I couldn't get a solution. So now I'm installing SPS 2003 to deep dive into it.

 

SharePoint 2010 Microsoft.SharePoint.Publishing.dll 사용시 Error

안녕하세요? Will입니다.

이번에는 제가 Navigation의 기능을 쓰기 위해 Microsoft.SharePoint.Publishing.dll 을 사용 했는데 빌드 시 Error가 나타나서 해당 Error에 대한

해결 방안을 쓰도록 하겠습니다.  해당 dll이 존재 하지 않는 다는 황당한 문구의 Error입니다. 분명히 참조를 시켜놧는데요.....

Error 내용 : The type or namespace name 'Publishing' does not exist in the namespace 'Microsoft.SharePoint' (are you missing an assembly reference?) 

Warrings 에서 보니깐 해당 dll은 System.Web.DataVisualization 이라는 dll 의 어느 Class를 사용 해서 Error가 난듯 합니다.

Warrings : The primary reference "Microsoft.SharePoint.Publishing, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL" could not be resolved because it has an indirect dependency on the framework assembly "System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" which could not be resolved in the currently targeted framework. ".NETFramework,Version=v3.5". To resolve this problem, either remove the reference "Microsoft.SharePoint.Publishing, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL" or retarget your application to a framework version which contains "System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35". 

그래서 해당 Dll을 검색 하여서 찾으니 아래의 폴더에 있군요. C:\Program Files (x86)\Microsoft Chart Controls\Assemblies\System.Web.DataVisualization.dll

드라이브는 설치에 따라서 틀립니다. 해당 dll 을 참조 해주고 다시 빌드를 하니 에러가 사라지며 잘 사용 되네요.

그리고 옛날에 Silverlight.dll 사용시에도 에러가 낫엇는데 해당 dll을 참조 하면은 Error 가 사라집니다.

SharePoint 2010 Custom Action

안녕하세요? Will 입니다.

이번시간에는 Custom Action에 대해서 자료를 올려 보도록 하겠습니다. SDK에 올라와 있는 자료를 가지고 원래는 글을 쓸려고 하였으나.

SDK자료가 에러가 나는 관계로 간단히 Custom Action을 만들어 보도록 하겠습니다.

1. VS2010으로 Project에서 새로운 프로젝트를 생성 하도록 하겠습니다. SharePoint2010에 있는 ContentType을 생성 하도록 하겠습니다.

2. VS2010 의 Feature.xml의 이름과 ContentType에 있는 이름을 알아서 변경 합니다.

3. Elements.xml 파일의 내용을 채웁니다.

Location 은 상태라고 생각 하시면은 됩니다. View모드냐 Edit모드냐와 같이 상태 모드입니다.

RegistrationId 는 문서라이브러니냐 아님 일반 리스트(100)냐 등등과 같이 리스트 값들이 지정되어있습니다. 아래 소스는 문서라이브러리(101)로 설정 하엿습니다.

RegistrationType 은 리스트냐, ContentType 이냐 등과 같은 걸 정의하는 곳입니다.

Title은 이름 그대로 타이틀입니다.

UrlAction 은 해당 타이틀이 선택 될때 동작할 내용을 적어 넣는 것입니다. 이번에는 간단히 test라는 알러트 창을 띄우겟습니다.

[code:xml;ln=off]

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <CustomAction Id="Ribbon.Library.Actions.AddAButton"
   Location="ViewToolbar"
   RegistrationId="101"
   RegistrationType="List"
   Title="Add a Ribbon Button">
    <UrlAction Url="javascript:alert('test');"/>
  </CustomAction>
  </Elements> 

[/code]

4. 내용을 채우고 나서 빌드를 하고 배포를 합니다.

SharePoint2010 SDK  의 내용 중 에러가 나는 곳이 CommandUIHandlers 안에 CommandUIHandler 의 프로파티 중 CommandScript 자체를

VS2010에서는 프로파티로 인식을 못합니다. 그래서 SDK는 에러가 납니다.

 소스는 아래에 첨부 합니다.

CustomAction.zip (37.64 kb)