posted by ekfn 2011. 3. 3. 11:37
참고 Url : http://hyderabadtechies.info/index.php/sms-alerts/index.php?option=com_content&view=article&id=789:hyderabad-techies-article

Automatic page refreshes were a big pain point in SharePoint 2007. If you had a  page or list that you wished  to   refresh at regular intervals, so it the event that another user entered   items, the screen would update, there was no easy/direct way of doing this. You could of could add using the Content Editor Web Part but this refreshes entire the entire page.

To overcome this, SharePoint 2010 introduces a new Ajax option has been added to  many webparts to enable auto refresh of webpart without refreshing the entire web page. This feature is available out of the box in SharePoint 2010 and no additional development is required.

How to use Auto Refresh Web parts in SharePoint 2010:

In SharePoint 2010, web parts have a new section in their tool panes - Ajax Options:
Auto Refresh Web Part

The key option is the Enable Asynchronous Automatic Refresh. Checking this will enable the Auto Refresh feature on the webpart. The Auto Refreshing Interval is the time interval in which webpart will get refreshed automatically.

Implementation:

To demonstrate the implementation I   created a custom list and added several items. Next, I added the list to a page as a web part. Editing the web part, I selected the checkbox to enable the automatic refresh and left the interval at the default 60 seconds (as shown above). I clicked Ok to save the settings and then saved the page (using the Stop Editing button) and thus generated a page with an auto-refreshing web part showing   the contents of the custom list:

Auto Refresh Web Part

posted by ekfn 2011. 2. 24. 18:01
참고 Url : http://www.synergyonline.com/blog/blog-moss/Lists/Posts/Post.aspx?ID=25

As many of you know, event receivers are a great way to hook into various SharePoint events.  These can apply to Feature events such as FeatureActivated, List events such as FieldAdded, and many others.  The most common set of receivers used, however, are part of SPItemEventReceiver which let you wire your code up to a number of events that can occur to items on a list or library.

When working with events, you’ll quickly find that before (synchronous) and after (asynchronous) events exist, and the method suffix such as “ing” (e.g. ItemAdding) and “ed” (e.g. ItemAdded) will tell you whether it gets invoked before or after the actual change is made.  Basic stuff.

And, as you get deeper, you’ll even find that you can extract the before and after state of the change.  For example, you can hook into the ItemUpdating event for a document library and prevent a user from changing a certain column.  The code might look like this:

public override void  ItemUpdating(SPItemEventProperties properties)
{
     if (properties.BeforeProperties["column"] != properties.AfterProperties["column"])
    {
        properties.Cancel = true;
        properties.ErrorMessage = "This column cannot be changed";
    }
}

For a document library, this works just fine.  However, you should know that the BeforeProperties hash table is not populated for items on a list.  As is worded in the SDK: “For documents, Before and After properties are guaranteed for post events, such as ItemUpdated, but Before properties are not available for post events on list items”

When they say “not available for post events on list items”, do they mean after events (like ItemUpdated, ItemDeleted, etc)?  The wording is curious here, so I thought I’d take some time to test each combination of common events such as Add, Update and Delete.  These were done across a custom list and then a document library.  Each test involved adding a new item, editing the item and then deleting the item.  Here are the results for a list:

List BeforeProperties AfterProperties properties.ListItem
ItemAdding No value New value Null
ItemAdded No value New value New value
ItemUpdating No value Changed value Original value
ItemUpdated No value Changed value Changed value
ItemDeleting No value No value Original value
ItemDeleted No value No value Null

No value means that column value in the hash table was not available.  
New value means that the correct value for the column was available.  
Changed value means that the correct updated value was available.
Original value means that the correct original value was available.

Here is the same test against a document library:

Library BeforeProperties AfterProperties properties.ListItem
ItemAdding No value No value Null
ItemAdded No value No value New value
ItemUpdating Original value Changed value Original value
ItemUpdated Original value Changed value Changed value
ItemDeleting No value No value Original value
ItemDeleted No value No value Null


Properties.ListItem refers the the current value for the list item at that point in the event.  Null means that the item is not available.  My analysis yields the following results:

  • Not surprisingly, we get null values for for ItemAdding (before item is added) and ItemDeleted (after item is deleted).  This was proven by Ishai Sagi some time ago.
  • As correctly documented in the SDK, item events for lists do not expose BeforeProperties.
  • ItemAdding and ItemAdded correctly report the value in the AfterProperties for an list item, but not a library item.  This is curious.
  • We have no visibility on the previous states during the ItemDeleted event.  Once it’s deleted, it’s clearly gone.


So, if we go back to our original problem listed above.  How can we prevent a user from changing a certain column for an item in a list event?  From the list table, you can see if we hook into the ItemUpdating event, we can compare the current item’s value (properties.ListItem) to the AfterProperties value.  The code would look like this:

if (properties.ListItem["column"] != properties.AfterProperties["column"])
{
    properties.Cancel = true;
    properties.ErrorMessage = "This column cannot be changed";
}

I hope this post gives you a better idea of how before and after events work for both lists and libraries.  Your comments and feedback are always welcomed.

posted by ekfn 2011. 2. 16. 11:05
참고 Url : http://www.smallworkarounds.net/2009/07/renaming-moss-2007-or-sharepoint-server.html

Renaming MOSS 2007 or Sharepoint Server

Many times there are situations when you have to rename a MOSS installation either in your virtual PC environment and also sometimes in production, although the production one is little uncommon but the point is a sharepoint developer at one point or other want’s to rename his sharepoint server.

Renaming the server simply will screw up all the settings inside the sharepoint as many places there are hardcoded references to the previous server which has to be remapped in order to run the MOSS server with the new server name.

Here in this article i will explain you the step by step process for renaming the MOSS server.There are few resources available on the net which helps you in achieving the same but it was hard for me to find a good resource, so i thought to pen it down so that it can help everyone using Sharepoint.

Steps:-

  1. Change Alternate Access Mappings
  2. Run stsadm for renaming the server.
  3. Rename the server physically on windows explorer.
  4. Reboot the server
  5. Update login credentials 
  6. Restart IIS
  7. Change identity references in IIS
  8. Reconfigure search index

1.Change Alternate Access Mappings

This is the first and foremost step to rename the Sharepoint server.Alternate access mappings can be found at Central Administration>Operations>Alternate Access Mappings

Click on the web application url and edit the url to have the new server name.This you have to do manually for every website.

 

2.Run stsadm for renaming the server.

You have to rename the server using stsadm before actually or physically renaming the sharepoint server.

The command to rename the server is

stsadm –o renameserver –newservername “[yournewservername]”   -oldservername “[youroldservername]“ ”and this is also shown in the figure below:-

stsadm can be found in “C:\ProgramFiles\Common Files\Microsoft Shared\web server extensions\12\bin\

Developers can set the path to be globally accessible for ease of using stsadm instead of navigating to the whole path.How to configure environment variables in order to get the stsadm available globally can be found here :-http://smallworkarounds.blogspot.com/2009/07/sharepoint-quick-tip-add-stsadmexe-to.html

3.Rename the server physically in the windows explorer

For this step just right click on the My Computer icon in the start menu and click on properties then on the Computer Name tab just click Change button and rename it to whatever new name you want to give to your sharepoint server installation.

4.Reboot the server

After following all the 3 steps mentioned above just reboot your sharepoint server.

5.Update Login Credentials

Updating credentials is must as sharepoint server is still mapped to the old username inside the domain and will thus cause problems.To update credentials we will again use stsadm.exe

stsadm –o updatefarmcredentials –userlogin “newservername\username” –password “yourpassword”

 

6.Restart IIS

IIS needs to be restarted in order to reflect the changes which we have just made in the above steps.

Remember to restart the IIS using iisreset/noforce from the command prompt.

7.Changing Identity references in IIS

After doing all these changes still sharepoint website’s application pools are mapped to the old username and servername which were used to install the Sharepoint inside the farm.So in order to get rid of this old server name we have to manually change the Identity references in the IIS.

Remember if the identity says “Predefined” and the value is set to Network Service then there is no need to play and touch those settings, let them be like that only.

 

 

But if the Identity is configurable then you have to replace the old servername with the new servername in the username section and if you want to change the password then you have to type the password and retype it to confirm and press ok

After this step almost everything is done you just have to configure search index to function properly.

8.Reconfigure Search Index

After renaming the sharepoint server the search index have to be reconfigured the best possible solution is to drop the search index and rebuild it. 

After doing all these changes you may still find at some places where few links are referencing your old server name and clicking those links does nothing more then giving a blank page to user saying nothing exists on the server like that which he is asking for.

In such scenarios you have to use your hit and trial method and have to find the root element which is causing this trouble and definitely that would be configurable just you have to figure out which is the right spot to configure this.

After doing this you might face problems with MySite which can be fixed once editing the People & Groups section of the MySite administration.

At last you can navigate through various pages to check that whether your MOSS 2007 server is working or not.

Disclaimer :- This article is based on my testing under my virtual environment things may vary and i advice not to test and play with your production farm sharepoint installations as this might damage your sharepoint server.

Happy Programming !!!!!!!!!!!!!!!!!!

posted by 준치 2010. 7. 19. 14:56
int aaa = 123456789;
string money = String.Format("{0:#,###}", aaa);
writer.WriteLine(money);

저렇게해서 찍으면...ㅎㅎ

123,456,789  이렇게 나와요..ㅎㅎㅎ
posted by 준치 2010. 3. 10. 17:56

Sys.WebForms.PageRequestManagerServerErrorException 오류
이 오류가 뭔가여?? 아~~

<%@Page ValidateRequest  ValidateRequest="false" 

ValidateRequest 를 설정하지 않으면 잠재적 위험요소 오류 발생

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="aa.aspx.cs" Inherits="aa" ValidateRequest="false"%>

ValidateRequest  아~~ 이거때문에 삽질했네...

기본을 까먹지 말자...캬캬캬

 


posted by 준치 2010. 3. 9. 19:08
vs2005를 실행해서 새로 만들기 했는데 sharepoint 관련 솔루션 또는 새항목이

안나와서 짱나 죽는 줄알았다..근데 BH 님께서 도와주심..쌩유..

우선 다른 블러그에서 다운로드해서 설치하라는데 그거때문에 그런건지는

확실하지 않다..그거는 vs2008 용이기 때문이다. 그래도 url은 적어야 함..ㅎ

http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=fb9d4b85-da2a-432e-91fb-d505199c49f6

첫번째

C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\ProjectTemplates\CSharp\SharePoint\1033 에 있는파일을
C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\ProjectTemplates\CSharp\SharePoint\1042
폴더 만들어서 복사해 넣는다.

두번째

C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\ItemTemplates\CSharp\SharePoint\1033 에 있는파일을
C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\ItemTemplates\CSharp\SharePoint\1042
폴더를 만들어서 복사해 넣는다.

시작 - 실행 - cmd 를 해서

C:\Program Files\Microsoft Visual Studio 8\Common7\IDE 이경로로 간다.

그후에 devenv /installvstemplates 를 실행.. 잠시 아무동작 않고 있다가

빠져 나간다..

이렇게 하고 Visual Studio 2005 를 다시 실행하면 된다.

이상입니당...


posted by 준치 2010. 2. 17. 16:57
c# 을 사용하는데 인코딩을하고 별 짓을 다해도 저장된 내용을

select 하면 한글이 깨져있다. 이건 뭥미~~

삽질하다가 생각났다.

Visual studio 에서 파일 - 저장고급옵션 을 선택하여

유니코드 UTF-8 65001 로 저장하면  제대로 된다.

이렇게 안하고 그냥  notepad에다가 넣어서 저장을 할때 속성을 변경해주고

다시 열면 적용이 된다.

ㅎㅎㅎ 삽질...
posted by 준치 2010. 1. 28. 16:30
너무 정리를 잘해주신거 같은데 제가 그냥 퍼와서 죄송한 마음이 드는군요...
다른 어떤분이 글을 남기셔서 찾다가 나왔네요..

출처 http://www.sqlleader.com/mboard.asp?exec=view&strBoardID=SS2005QNA&intSeq=1543

여기 좋은 정보가 많을 듯하네여... http://www.sqlleader.com

-----------------------------------------------------------------------
몇 가지 경우가 있을 것 같은데요,
 
쿼리창에서 다음과 같이 명령을 실행시키셔서 백업 파일 셋트의 수를 확인해 보시기 바랍니다.
 
RESTORE LABELONLY FROM DISK='d:\TestDB1.bak'

위의 명령을 수행한 결과 중, FamilyCount가 백업을 할 때의 파일 (or 미디어)의 수를 의미합니다.
 
다음과 같은 예제로 설명드리겠습니다.
 

--데이터베이스 생성

CREATE DATABASE TestDB

ON (name='data1', filename='d:\data1.mdf')

LOG ON (name='log', filename='d:\log.ldf')

GO

 

--백업 수행(D:\Test1.bak, D:\Test2.bak에 나누어서 백업)

BACKUP DATABASE TestDB TO DISK='d:\TestDB1.bak' , DISK='d:\TestDB2.bak' WITH INIT

GO

 

--기존 데이터베이스 삭제

DROP DATABASE TestDB

GO

 
 
즉, TestDB라는 데이터베이스는 TestDB1.bak와 TestDB2.bak 라는 두 개의 파일에 백업이 되었습니다.
 
 
이 백업 파일을 이용해서 복원을 할 경우, 두 개의 파일 모두를 지정해야 제대로 되며, 하나만 지정해서 복원할 경우, 말씀하신 것과 같은 에러가 발생합니다.
 
 
 
 
이는 Management Studio에서도 동일합니다.
 
이 경우, 장치 부분에서 나머지 백업 파일을 지정해야 에러 없이 복원이 가능합니다.
 
 
 
처음에 백업을 받았을 때, 파일 또는 미디어들이 어떻게 설정되어 있는지 확인하시고, 복원시 이를 모두 지정해 주시기 바랍니다.
 
 
 



 
처음전체백업을 받아서 덮어쓰기 옵션으로 다른서버에서 복구를 성공시켰는데
 
이후 다시 이전서버백업으로 신규서버로 복원을 하려고 하니
 
아래와 같은 에러가 발생합니다
 
-----------------------------------------------------
System.Data.SqlClient.SqlError: 미디어 세트에 2개의 미디어 패밀리가 있지만 1개만 제공하고 있습니다.
모든 멤버를 제공해야 합니다. (Microsoft.SqlServer.Smo)
-----------------------------------------------------
 
어떻게 해야할까요..?

posted by 준치 2010. 1. 28. 16:11
 -탐색기를 실행한다.
-도구 메뉴에서 폴더 옵션을 선택한다.
-폴더 옵션 창에서 파일 형식 탭을 선택한다.
-변경할 파일 형식(XLS, PPT, DOC 등)을 선택한 후에 고급 버튼을 누른다.
-아래쪽에서 같은 창에서 열기 옵션을 해제한다.

열기에 관련 된 내용이기도 하다.

posted by 준치 2010. 1. 19. 16:01


첫발을 어떻게 할지 몰라서 그냥 찾다가 url만 써 놓기..

정말 정리 잘하셨네여..ㅎㅎ

http://ozahir.com/869