Qeb Archives: SharePoint Development

Vim li cas ib tug rau "ib los sis ntau tshaj teb yam yeej tsis ntsia zoo zoo”

Kuv twb ua ib tus tweak me nag hmo rau ib qho Web site uas yog ib cov lus nug CAML tiv thaiv tsis tau ib daim ntawv teev.  Kuv tau muab hloov dua tshiab, deployed nws thiab tau mus ntaus nrog rau ib qho kev ua yuam kev:

Kev npaj txhij txog qhov kev ua yuam kev muaj tshwm sim nyob rau hauv 3 hnub Outlook huab cua Forecast WebPart. Thov hu rau tus neeg khiav dej num hauv qhov system. Ib los yog ntau tshaj tus teb yam yeej tsis ntsia zoo zoo. Mus rau ntawm daim ntawv teev nqis nplooj yuav rho tawm tej liaj teb.

Kuv yog txojkev lwm oddball meem lawm ces kuv tsis tam sim ntawd xa kuv cov lus nug CAML mus rau qhov yuam kev ntawm SharePoint twb qhia rau kuv.  Kuv puas nrhiav bing ceev thiab thiab nyob no cov ncej tswv blog by Sandeep Nahta  (http://snahta.blogspot.com/2009/01/one-or-more-field-types-are-not.html).

Ntawm no yog cov lus nug uas phem:

lus nug.Query ="<Nyob qhov twg><Thiab><Neq><FieldRef Name = 'Abbr' /><Value yam = 'Ntawv'>SFNY</Tus nqi><FieldRef Name = 'Abbr' /><Value yam = 'Ntawv'>SFIS</Tus nqi></Neq></Thiab></Nyob qhov twg>";

Ntawm no nws yog tsau:

lus nug.Query ="<Nyob qhov twg><Thiab><Neq><FieldRef Name = 'Abbr' /><Value yam = 'Ntawv'>SFNY</Tus nqi></Neq><Neq><FieldRef Name = 'Abbr' /><Value yam = 'Ntawv'>SFIS</Tus nqi></Neq></Thiab></Nyob qhov twg>";

Li ntawd, yog tus moral txog zaj dabneeg: xyuas kom tseeb tias koj cov CAML yog tseeb los koj kuj yuav tau txais ib qho kev ua yuam kev oddball.

Subscribe rau kuv blog.

Raws li kuv nyob Twitter tom http://www.twitter.com/pagalvin

</kawg>

SharePoint 2010 Kua nyam "Deploying” Xwm txheej

Kuv siv PowerShell deploy tov kom ib tus neeg ua liaj ua teb SharePoint (h/t:  Corey Roth thiab nws Blog ncej). 

Kuv mam li mus rau hauv central admin, accessed System nqis thiab ces "Manage teb dlaws" rau deploy nws tus ua liaj ua teb thiab yuav kuv (me ntsis) dismay, nws tau mus tua nyob rau hauv "deploying".

Kuv twb pom no qhov teeb meem los ntau zaus nyob rau lub MSDN forums, li ntawd, kuv twb tshee zoo nkauj hais txog nws.  Kuv nrhiav ib ncig me ntsis thiab nyob no yuav pab tau hauv tsab xov xwm (yog tus neeg ntawm seemingly unattributed http://www.resolutionsnet.co.uk/).  Kuv lawm os txiag hauj lwm thiab thaum twg kuv clicked rau hauv txoj kev hais haum, nws qhia kuv tias nws twb ntse deployed txoj kev hais haum rau peb lub servers plaub hauv lub teb.

Kuv mus hauv errant neeg rau zaub mov, nres qhov kev pab cuam timer thiab restarted rau nws.  Cov neeg rau zaub mov qhov rais yeej qhia kuv paub hais tias cov kev pab cuam tejyam mus li qhov hais kom ua, yog li ntawd qhia kuv tias nws yog mob.

Lub sij hawm no, Thaum kuv rov mus hab txhawb admin, Kuv twb tau deploy uas tsis muaj teeb meem.

Hopefully me ntsis no pab ntxiv yog yuav pab kom tej yam nyob hauv tus bind ib hnub.

</kawg>

Subscribe rau kuv blog.

Raws li kuv nyob Twitter tom http://www.twitter.com/pagalvin

Yuam kev rau ib hnub: "Tsis tau ntxiv rau daim kev cai tswjhwm los ua ke rau lub GAC”

Kuv twb tau ntaus ib ntsis nrog siv qhov muag saib lub studio 2010 rau ib tug ib lub kua sp2010 thiab tus tau txais qhov yuam kev:

Yuam kev tshwm sim txiag kauj ruam 'Ntxiv kua': Yuam kev: Tsis tau ntxiv rau daim kev cai tswjhwm los ua ke rau lub ntiaj teb no los ua ke cache: YourAwesomeDLLThat IAmJustNotGoingToInstallRightNow.dll

Kuv mus rau lub GAC xwb (c:\windowsassembly) sim thiab tshem tawm thiab tau txais ib "ntaub ntawv nyob rau hauv kev siv" kev ua yuam kev.

Kuv tsis muaj iisreset, Kuv yuav luag downloaded sysinternals, Kuv tsis timer pab hauv cov kev pab cuam... Thaum kawg, Kuv cia li kaw thiab sab kev studio xwb thiab kuv twb tau kaw thaum kawg.

</kawg>

Subscribe rau kuv blog.

Raws li kuv nyob Twitter tom http://www.twitter.com/pagalvin

Txoj kev sai thiab yooj yim: Debugging VS 2010 Kua txiag

Nrig txog kev pom Studio 2010 ntaub ntawv qhia txog nyuaj-rau-debug kom raug thaum txiag ib zaug.  Ib txoj kev sai thiab yooj yim txoj kev los ua ib co heev ntxhib debugging yog pov raug teev hais qhov xyuas koj tus kheej.  Nrig txog kev pom Studio yuav qhia lawv nyob hauv cov zis console.

Xav txog cai no me ntsis:

image

Yog no feature scoped rau ib daim ntawv thov Web site, kawm ntawv yuav tsum thov.  Yog koj sim thiab reference ib thaj chaw, tej zaum koj yuav tau qhov yuam kev tsis meej xwm:

Yuam kev tshwm sim txiag kauj ruam 'Ntxiv kua': Kwv siv tsis tau teem rau kev lom los ntawm ib tug kwv.

Txawm li cas los, yog muab ib tug tshiab kos thiab dhau ib txoj hlua kom cov constructor, koj tau txais kev pab tau ib nyuag tshaj lus:

image

Nws yog ib tug txheej txheem uas crude, tab sis, zoo nkauj yoo mov thiab yooj yim.

</kawg>

Subscribe rau kuv blog.

Raws li kuv nyob Twitter tom http://www.twitter.com/pagalvin

Timer hauj FeatureActivated thiab Feature tau

Kuv twb tau ua hauj lwm nrog ib co cai uas ib tug neeg tso kuv rau ib txoj hauj lwm hauv timer no.  Nws tsis tau muab qhov tseeb feature ua kom txoj kuv thiaj sau, tau mas.  Kuv coj kom zoo dua Andrew Connell nto moo blog ncej nyob rau cov kawm.

Kuv siv kuv siv qhov muag saib lub Studio 2010 thiab muaj txiag ceev cia zoo zoo tsis muaj ib qho kev ua yuam kev "yuam kev tshwm sim txiag kauj ruam 'Add kua': Kwv siv tsis tau rau thaj ntawm ib yam twj paj nruas."

Kuv twb noj nws chaws cia ib yam nkaus thiab.  Kuv yog scoping tus feature Web site daim ntawv qib, li:

image

Yog li ntawd, cov khoom uas yuav muab xa mus rau lub receiver uas yog los ntawm daim ntawv thov li qhov web, tsis muaj qhov chaw sau.  Thaum kawg, txoj cai zoo li no:

pej xeem override qhuav qhawv FeatureActivated(SPFeatureReceiverProperties zog)
{

    // Tsis txhob ua cov nram no nrog lub web app scoped nta, nws ua rau nws poob siab Luag nyav
    // SPSite chaw = zog.Feature.Parent li SPSite;

    SPWebApplication wa = zog.Feature.Parent li SPWebApplication;

    Yog hais tias (WA == null) pov tshiab kos("webapp2 yog thov.");

    foreach (SPJobDefinition hauj lwm hauv wa.JobDefinitions)
    {

        ua tiag
        {
            Yog hais tias (txoj hauj lwm.Lub npe == List_JOB_NAME)

                txoj hauj lwm.Rho tawm();
        }
        ntes (Kos e)
        {
            pov tshiab kos("cim 2");
        } // txhom kos e
    }

    // nruab qhov hauj lwm

    WeatherForecastTimerJob weatherForecastTimerJob =
        tshiab WeatherForecastTimerJob(List_JOB_NAME, WA);

    SPMinuteSchedule teem caij = tshiab SPMinuteSchedule();
    teem.BeginSecond = 0;
    teem.EndSecond = 59;
    teem.Luv = 5;
    weatherForecastTimerJob.Schedule = raws sij hawm;
    weatherForecastTimerJob.Update();

}

Tus yuam sij take-away yog tias thaum tus feature scoped rau lub Web site app, tus SPFeatureReceiverProperties SharePoint mus rau koj lub receiver feature kis tus Web site app theem tsis.  Andrew tus qub blog nkag assumes scoped mus rau hauv qhov chaw sau ntawv.

</kawg>

Subscribe rau kuv blog.

Raws li kuv nyob Twitter tom http://www.twitter.com/pagalvin

Qhov Microsoft.SharePoint.ApplicationPages.Administration.dll twg?

Kuv twb tso ib qhov project siv qhov muag saib lub studio uas references Microsoft.SharePoint.ApplicationPages.Administration.dll.  Nws coj kuv me ntsis thaum yuav paub nws thiab kuv thought kuv yuav qhia.  Nyob rau hauv kuv ib puag ncig, Nws yog nyob ntawm:

c:\qhov kev pab cuam filescommon filesmicrosoft sharedweb neeg rau zaub mov extensions14configadminbin

</kawg>

Subscribe rau kuv blog.

Raws li kuv nyob Twitter tom http://www.twitter.com/pagalvin

CodePlex Project – SP2010 Explorer

Ua ib feem ntawm ib qho ntawm siv zog kawm txoj kev uas tsis muaj qib txog kev SharePoint 2010, Kuv twb tau tsim ib tug "SharePoint Explorer"zoo ntawm cov cuab tam.  Lub tswv yim tsis yog tshiab.  Kuv siv tau qhov project no ntau tshaj ib zaug: http://sharepointexplorer.codeplex.com/.  Kuv lub tswv yim no yog tsim muaj SharePoint version uas siv txuas nrog qhov chaw web site qhia txhua tus low-level qhia tias tus kwv qauv yuav muab tau. 

Pab raws no cov ncej blog li li ob muaj tshaj peb tes num raws li tus hu tau tuaj pab dawb.  Yog hais tias koj xav ua haujlwm rau project no, qhia rau kuv paub ntawm tug (galvin.Paul@gmail.com) thiab peb mam li ua nws.

Ntawm no yog peb tes num: http://sp2010explorer.codeplex.com/

</kawg>

Subscribe rau kuv blog.

Raws li kuv nyob Twitter tom http://www.twitter.com/pagalvin

Ua hauj lwm nrog cov TreeNodeBinding hauv lub ASP.NET Treeview Control

Kuv twb tau ua hauj lwm rau dab tsi kuv vam yuav muaj sai-tso CodePlex teg num npaaj zoo integrated me ntsis ntawm cov Web site qhov neb sib tham tsis tau ntawm tus neeg zov me nyuam los muab siv sib txuas lawv kawm ua ib qhov chaw SharePoint nyob rau hauv daim npog.  (Qhov no yeej tau tau ua ntej, tab sis qhov no yog kev kawm project ntau li ntau dabtsi ntxiv).  Qhov no yog meant yuav ib daim tuaj hloov rau lub qhov rais explorer saib ntawm SharePoint 2010 daim ntawv qiv.

Cov cai no muaj li ib txwm recursive hu mus rau nram lub SPWeb thiab SPLists tus zauv pib taw tes.  Cov kwv yog cov ntawd traversing leem tus hlua XML uas zoo li tej yam zoo li no:

<sitecollection url =’http://demo2010a:9090′>
 
<Web site
     Title = 'Nyob zoo ntiaj teb Sandbox' 
     Template =' tus kawm ntawv nrog ceev nrooj miv, sau, thiab muab lus qhia, BLAH BLAH BLAH'>

     <sau
        Title ='BCC_Health_Services_FAQs’
        Template ='CustomList’
       
listid =’http://demo2010a:9090/helloworldsandbox[delim]1e02b001-3cb2-4f17-b63d-7809e86b4174′>
    
</sau>

     <sau
        Title = 'BCC_Notifications' 
        Template = 'CustomList' 
        listid =’
http://demo2010a:9090/helloworldsandbox[delim]5a5a13d1 - 877c - 41c 0-9063-b9612be80d5e’>
     </sau>

  </Web site>

</sitecollection>

Kuv mam los ntxuav tu uas XML ua ntej txhua yam yog hais thiab ua.

Kuv xav kom thaum kawg tau cov lus qhia ntawd mus thiab mus ua tus Treeview tswj.  Tsis raws nraim earth shattering khoom.

Kev xwb yuab kuv muab rau koj yog coj mus cuag cov ntoo pom los tiv thaiv XML tej ntaub ntawv los siv manually tsev li kuv treenodes raws li kuv traverse rau tsob ntoo.  Kuv puas no tej vim kuv tabtom txhob txwm tshaj tawm ua tej yam nyuaj rau kuv tus kheej (qhov no nws yog ib qhov project rua suav) thiab tej vim kuv muaj qhov vague notion uas tsev nce ntoo o li tsob ntoo traverse kuv tsis yog ib lub tswv yim zoo rau lub sij hawm ntev.

Qhov teeb meem nrog cov kauj yog tias cov Treeview tswj tsis paub txog qhov zoo muab rau hauv cov ntshav nthuav xws li "sau" los yog "Web site" kom nws pom tias cov zis no los vim:

 

image

Yog tsis pab.  Qhov no yog qhov chaw rau cov hoob kawm TreeNodeBinding pab.  Kuv siv tau qhov no qhia rau cov tswj Treeview li cas yuav tsum txhais rau XML.  Ntawm no yog ib qho piv txwv:

tnb = TreeNodeBinding tshiab();
tnb.DataMember = "sau"; // Qhov no nws yog cov ntawv sau nyob hauv lub xml rau ib qhov chaw.
tnb.TargetField = "listid";
tnb.ValueField = "title";
tnb.ToolTipField = "Template";

No losis tswvyim dabtsi qhia rau treeview tias thaum nws pom ib tug <sau> ntawm nyob rau hauv cov XML, siv cov nabkaus rau TargetField, ValueField thiab ToolTipField.  Nyob hauv ntuj app, cov map raws li nram no:

  • TargetField: Thaum ib tug neeg clicks nyob rau ib cov nqi ntawm, qhov no yog koj yuav tau dab tsi rau SelectedNode.Value.  Yog li no tsis yog tsis meej pem nrog...
  • ValueField: Qhov no yog dab tsi koj xav qhov Treeview los tso saib kom tus neeg siv.
  • ToolTipField: Tus nqi ntawm cov XML uas koj xav ua ib Tooltip.

Ntxiv tias TreeNodebinding ntoo pom cov DataBindings thiab koj tau output li no:

 

image

Kuv mam muaj ntau rau txhua yam no ntxiv rau peb tes num thiab nws thiaj li muab qhov no rau Codeplex.

</kawg>

Subscribe rau kuv blog.

Raws li kuv nyob Twitter tom http://www.twitter.com/pagalvin

Txuas ntawv teb ntxaij lim dej rau koj cov qhov Web kev cai

Kuv xav tau cov ntaub ntawv los ntawm ib cov ntawv teb lim hauv SharePoint 2010 mus rau kuv qhov web kev cai.  Kuv sim siv no cov tshooj MSDN puas yog pheej tab sis tsab xov xwm yog tog twg los lawm los kuv kuv cia li tsis ua raws li nws kom raug.

Ib me ntsis ntxiv searching nres tsis Mike Smith MSDN tshab ntawm no (http://social.msdn.microsoft.com/forums/en-us/sharepointdevelopment/thread/72F1732A-7F93-441E-8644-2E82BBB153D9).

Yog khoom ntawm connectable Web site yog xeem tawm muaj ntau tab sis yog Mike cov tshooj lus kom raws li nws tau.

</kawg>

Subscribe rau kuv blog.

Raws li kuv nyob Twitter tom http://www.twitter.com/pagalvin

Txoj kev sai thiab yooj yim: Xa Email siv cov neeg rau zaub Gmail SMTP mov hauv .net C#

Qhov no tsis yog ib lub npe tswvyim tshiab nraim, tab sis, thaum twg kuv tau mus ua, Kuv pom muaj ntau heev "vim li cas thiaj tsis no ua hauj lwm rau kuv" thiab tsis ntau teb mus. Kuv vam tias ib tug neeg pom qhov no pab tau.

Tus me ntsis raws cai yuav xa ib tug siv tau kuv tus kheej gmail tus account ua, xws li attachments:

siv System.net.mail;
siv System.net;

NetworkCredential loginInfo = tshiab NetworkCredential("[Kuv tus Gmail ID]", "[Kuv tus Gmail Password]");
MailMessage msg = tshiab MailMessage();
msg.Ntawm = tshiab MailAddress("[M Gmail Id]@gmail.com");
msg.To.ADD(tshiab MailAddress("paul.galvin@arcovis.com"));
msg.Ntawv = "Sim infopath dev kawm";
msg.Lub cev = "<html><lub cev><muaj zog>Lus zoo heev.</muaj zog></lub cev></html>";
msg.IsBodyHtml = tseeb;

foreach (hlua aFile nyob rau hauv NIPFD.GetAttachmentNamesAndLocations())
{
    msg.Attachments.ADD(tshiab Symptoms(aFile));
} // Ntxiv attachments.

SmtpClient neeg = tshiab SmtpClient("smtp.gmail.com");
tus thov kev pab.EnableSsl = tseeb;
tus thov kev pab.UseDefaultCredentials = tsis tseeb;
tus thov kev pab.Peev xwm = loginInfo;
tus thov kev pab.Chaw nres nkoj = 587;
tus thov kev pab.EnableSsl = tseeb;
tus thov kev pab.Xa(msg);

Ob peb tseem ceeb khoom uas tub ceevxwm kuv cia thiab lwm yam tswvyim / sau ntawv:

  • Rau thawj kab ntawd tus loginInfo kwv ua ib qho kev siv tus gmail ID stripped ntawm "@gmail.com”. Li ntawd, Yog hais tias kuv gmail email chaw nyob "sharepoint@gmail.com"thiab kuv lo lus qhib yog"xyzzy"ces tus kab yuav zoo li:

NetworkCredential loginInfo = tshiab NetworkCredential("sharepoint", "xyzzy");

  • Kuv tus account gmail yog teem rau koj siv cov SSL thiab cov uas tsis yog ib qho teeb meem.
  • Ib co tseem qhia rau dab chaw nres nkoj siv nws txoj sia?. Kuv siv chaw nres nkoj 587 thiab nws ua haujlwm fine rau kuv.
  • Hauv kuv tsev neeg, Kuv kuj yuav tsum tau xa attachments. Tias kwv NIPFD muaj ib txoj kev uas yuav paub txog qhov twg kuv attachments yog. Nws rov muaj lub siab kev (e.g. "c:\tempattachment1.jpg". Thaum kuv mus, Kuv muaj ob tug attachments thiab nkawd ob leeg tau haujlwm fine.

Kuv siv siv qhov muag saib lub studio 2008 sau txoj.

</kawg>

Subscribe rau kuv blog.

Raws li kuv nyob Twitter tom http://www.twitter.com/pagalvin

Ntawv cim npe Technorati: ,,,