2013年2月19日 星期二

windows 2000 HD 127 gb limit

今天要把之前舊系統(windows 2000)的資料COPY  到一個新建好的VHD 中.
可是在建了 VHD後.進系統確只能看到 127 GB 的HD, 原因 windows 2000 sp2 之前不支援 48 bit LBA .所以 disk 會有 127 GB 的限制.
請將 windows 2000 升到SP4 後去新增一個機碼
  1. 開啟「登錄編輯程式」(Regedt32.exe)。
  2. 找出並按一下登錄中的下列機碼:
    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Atapi\Parameters
  3. [編輯] 功能表上,按一下 [新增值],然後新增下列登錄值:
    數值名稱:EnableBigLba
    資料類型:REG_DWORD
    數值資料:0x1
  4. 結束「登錄編輯程式」。

重開機就好了.

主要是參考下列的資訊

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

2012年8月13日 星期一

Sharepoint BDC 外部清單 下載 Excel

好不容易在整理好 BDC 後才發現他無法使用內建的功能來下載清單到 EXCEL 中.上網找了很久都找到2007 的作法. 那些API 有很多都是已停用的(雖然有人試出來,但我沒有 :( )

好了.以下是這個程式碼

<%@ Assembly Name="mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" %>
<%@ Assembly Name="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>  
<%@ Assembly Name="System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" %>
<%@ Assembly Name="Microsoft.SharePoint.Portal, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Assembly Name="Microsoft.BusinessData, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ WebHandler Language="C#" Class="ExcelDumper"  %>
using System;
using System.Web;
using System.Web.UI;
using System.Web.SessionState;
using System.Collections;
using System.Collections.Generic;
using Microsoft.SharePoint;

using Microsoft.BusinessData.MetadataModel.Collections;
using Microsoft.BusinessData.Infrastructure;
using Microsoft.BusinessData.MetadataModel;
using Microsoft.BusinessData.Runtime;
using Microsoft.SharePoint.BusinessData.SharedService;
using Microsoft.SharePoint.Administration;
using System.Web;
using Microsoft.Office.Server.ApplicationRegistry.SystemSpecific.Db;
public class ExcelDumper : IHttpHandler, IReadOnlySessionState
{
    public bool IsReusable
    {
        get { return false; }
    }
    public void ProcessRequest(HttpContext context)
    {
       
        //entityNS = "GW_BDCM_IP.IP_ALL";
        //string entityName = "ENT_IP_ALL_";/
        string siteURL = "http://spcenter/IP/";
        string entityNS = "GW_BDCM_IP.IP_ALL";// "<nameSpace>";
        string entityName = "ENT_IP_ALL";// "<entityName>";
        string methodInstanceName = "ReadList";//"<methodInstanceName>";
        string H_HTML = "", TB_HTML = "", B_HTML = "";
        bool firtLine = true;
        context.Response.ContentType = "application/vnd.ms-excel";
       
        //context.Response.ContentType =
        //header('Content-disposition: attachment; filename='.$q);
       
        if (context.Request["entityNS"] != null)
        {
            entityNS = context.Request["entityNS"];
        }
        if (context.Request["entityName"] != null)
        {
            entityName = context.Request["entityName"];
        }
        if (context.Request["methodInstanceName"] != null)
        {
            methodInstanceName = context.Request["methodInstanceName"];
        }
       
        using (SPSite site = new SPSite(SPContext.Current.Site.Url))
        {
            using (new Microsoft.SharePoint.SPServiceContextScope(
                SPServiceContext.GetContext(site)))
            {
                BdcService service = SPFarm.Local.Services.GetValue<BdcService>(String.Empty);
                IMetadataCatalog catalog = service.GetDatabaseBackedMetadataCatalog(SPServiceContext.Current);
                IEntity entity = catalog.GetEntity(entityNS, entityName);
                IMethodInstance imethInst = entity.GetMethodInstance(methodInstanceName, MethodInstanceType.Finder);
                IEntityInstanceEnumerator prodEntityInstanceEnumerator = entity.FindFiltered(imethInst.GetFilters(), entity.GetLobSystem().GetLobSystemInstances()[0].Value);
              
                context.Response.Headers.Add("Content-Disposition", "attachment; filename='Download.xls'");
               
                while (prodEntityInstanceEnumerator.MoveNext())
                {
                    IEntityInstance IE = prodEntityInstanceEnumerator.Current;
                    foreach (IField f in entity.GetFinderView(methodInstanceName).Fields)
                    {
                        if (firtLine)
                        {
                            H_HTML = string.Format("{0}<td>{1}</td>", H_HTML, f.DefaultDisplayName );
                        }
                        TB_HTML = string.Format("{0}<td>{1}</td>", TB_HTML, IE[f].ToString().Replace("\r\n", "<br style=\"mso-data-placement:same-cell;\" />"));
                    }
                    B_HTML = string.Format("{0}<tr>{1}</tr>", B_HTML, TB_HTML);
                    if (firtLine)
                    {
                        B_HTML = string.Format("<tr>{0}</tr>{1}", H_HTML, B_HTML);
                    }
                    TB_HTML = "";
                    firtLine = false;
                }
                B_HTML = string.Format("<table>{0}</table>", B_HTML);
                context.Response.Write(B_HTML);
            }
        }
    }
}

使用方式
1.將這個代碼 存到 C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS 目錄下. 並存成 .ashx 檔
2. 自己在網站中建立一個LINK 網址設為
 http://spcenter/IP/_layouts/excel02.ashx?entityNS=GW_BDCM_IP.IP_ALL&entityName=ENT_IP_ALL
參數內容自己看.

2012年8月8日 星期三

找不到網站設定的的 導覽功能 無法編輯上方工具的選單

Sharepoint 開啟 發佈功能 才可以看到導覽功能才進行編輯上方工具列
在網站動作->網站設定->網站動作->管理網站功能 啟動 發佈功能 就可以了.



BDC Model: Sharepoint VS2010 debug 時出現ERROR. Could not load the Web.config configuration file. Check the file for any malformed XML elements,

Could not load the Web.config configuration file. Check the file for any malformed XML elements ...
那是因為 本身site url 是 http://spcenter 可是我打成 http://spcenter.domain.com.tw (這個不是預設) 所以會出現這個錯誤. 把他改回 http:/spcenter 或是將 http://spcenter.domain.com.tw 改成預設就好了.

2012年8月6日 星期一

Sharepoint Web.config 修改成Debug and trace



修改 c:\INTEPUB\WWWROOT\WSS\Virtual XXXX\80\WEB.CONFIG

Find:

<system.web> …<customErrors mode=”On” />

Change To:
<system.web> …<customErrors mode=”Off” />
Find:
<SharePoint>
<SafeMode … CallStack=”false” … >
</SharePoint>
Change To:
<SharePoint>
<SafeMode … CallStack=”true” … >
</SharePoint>

Enable Debugging Mode: Set batch and debug to “true”
Find: <compilation batch=”false” debug=”false”>
Change To: <compilation batch=”true” debug=”true”>


並在WEB.CONFIG 檔中的SYSTEM.WEB 區段中加入下行的
<trace enabled=”true” pageOutput=”true”/>


您的備份來自不同版本的 Microsoft SharePoint Foundation,且不能還原至執行目前版本

那是因為 內容資料庫的版本不對. 你可以去 Sharepoint 管理中心去看.各個內容資料庫的版本狀態. 在管理中心->升級與移轉->檢閱資料庫狀態  中去看看有那些是需要升級的.
我這只看到 WSS_Content 這個資料庫需要升級.
所以 開始\Microsoft SharePoint 2010 Products\SharePoint 2010 管理命令介面 輸入以下指令

Upgrade-SPContentDatabase   -Identity  "WSS_Content"

便可升級 內容資料庫 到最新.