MUSCUS: Donec eget - Consuetudo notitia typus

Negotium Missionem:

Exsecutionem Enterprise late comitatur cum musco ad manufacturing 30+ et sites paucis duodenas corporatum Dicasteria.

Negotium Objective:

Quamquam multitudo negotium coetus (Dicasteria, locus, etc), certa notitia in a global gradu serventur. Verbigratia, auctoritate domini elencho omnium corporalium locorum comitatu (e.g. vestibulum urna, CELLA locus, officia Sales) Vestibulum ut ipsum esse in.

Forsit technica:

Explebuntur multiplex utitur situ inceptum est Doct collectæ. Vellemus auctoritate creare consuetudinem locorum index corporalis WSS album. Igitur, habere debuit, cum in una cohors adipiscing elit (aut agmine album additur seu doctrinee bibliotheca) quod corporatum continentur locis, we would create a column using the "lookup" datatype et ad hoc dominum album.

Infeliciter, lookup datatypes must access a source list "locally" id quod potest non adjicies nostra auctoritate album site collectæ.

Solutio technica:

Implement novus ratio mos notitia substructio SPField et repraesentatur tamquam DropDownList implemented in in UI quo a domino ListItems frequentare WSS album.

Nos novum collection site dicitur "http://localhost/EnterpriseData". Ibi, we created a custom list named "Corporate Locations". This list just uses the standard "Title" agri continent ipsum ordinem situs corporatum.

Sequitur plures gradus discreti creare consuetudinem notitia typus in WSS. Sunt:

  1. Genus definiamus, quae ex hereditate SPField (si ab aliis requiri potest hereditábunt).

Hic est enim, qui Codicis:

publica genus XYZZYCorporateLocationField : SPFieldText
{
publica XYZZYCorporateLocationField
(SPFieldCollection agris, filum typeName, filum displayName)
: basis(agris, typeName, displayName) { }

publica XYZZYCorporateLocationField
(SPFieldCollection agris, filum displayName)
: basis(agris, displayName) { }

publica dominari BaseFieldControl FieldRenderingControl
{
impetro
{
BaseFieldControl control = novum XYZZYCorporateLocationFieldControl();
control.FieldName = hoc.Internum Name;
revertetur control;
} //impetro
} // fieldrenderingcontrol

publica dominari filum GetValidatedString(Obiectum valor)
{
si (hoc.Required || value.ToString().Pares(String.Vacuam))
{
mittent novum SPFieldValidationException ("Department is not assigned.");
}
revertetur basis.GetValidatedString(valor);
} // getvalidatedstring

} // XYZZYCorporateLocation

  1. Alterum genus, quod ex eadem basi agro imperium definire capiendi, ut in:

publica genus XYZZYCorporateLocationFieldControl : BaseFieldControl
{
protegetur DropDownList XYZZYCorporateLocationSelector;

protegetur dominari filum DefaultTemplateName
{
impetro
{
revertetur "XYZZYCorporateLocationFieldControl";
}
} // DefaultTemplateName

publica dominari Obiectum Valor
{
impetro
{
EnsureChildControls();
revertetur hoc.XYZZYCorporateLocationSelector.SelectedValue;
} // impetro
statuet
{
EnsureChildControls();
hoc.XYZZYCorporateLocationSelector.SelectedValue = (filum)hoc.ItemFieldValue;
} // statuet
} // override object Value

protegetur dominari Irrita CreateChildControls()
{

si (hoc.Field == nihilo || hoc.ControlMode == SPControlMode.Propono)
revertetur;

basis.CreateChildControls();

hoc.XYZZYCorporateLocationSelector =
(DropDownList)TemplateContainer.FindControl("XYZZYCorporateLocationSelector");

si (hoc.XYZZYCorporateLocationSelector == nihilo)
mittent novum Exceptio("ERROR: Cannot load .ASCX file!");

si (!hoc.Page.IsPostBack)
{

usura (SPSite site = novum SPSite("Http://localhost / enterprisedata"))
{
usura (SPWeb web = site.OpenWeb())
{

SPList currentList = web.Lists["Corporate Locations"];

foreach (SPItem XYZZYCorporateLocation in currentList.Items)
{
si (XYZZYCorporateLocation["Title"] == nihilo) perseverant;

filum theTitle;
theTitle = XYZZYCorporateLocation["Title"].ToString();

hoc.XYZZYCorporateLocationSelector.Items.Add
(novum ListItem(theTitle, theTitle));

} // foreach

} // using spweb web = site.openweb()
} // using spsite site = new spsite("Http://localhost/enterprisedata")

} // if not a postback

} // CreateChildControls

} // XYZZYCorporateLocationFieldControl

Supra Codex plerumque ratione ad effectum adducit populating in DropDownList valoribus a consuetudine WSS sita album http://localhost/enterprisedata and named "Corporate Departments".

Ego utrosque in uno definiri. CS file, Composuit et pones in GAC (fortis inquisita, utique).

  1. Peragendam imperium template (.ascx) ut ostensum:

<%@ Continere Linguam="C#" Capiendi="Microsoft.SharePoint.Portal.ServerAdmin.CreateSiteCollectionPanel1,Microsoft.SharePoint.Portal,Vulgate = 12.0.0.0, culturae neutra =,PublicKeyToken = 71e9bce111e9429c" compilationMode="Always" %>
<%
@ Register Tagprefix="wssawc" Spatium nominale="Microsoft.SharePoint.WebControls" Conventu="Microsoft.SharePoint, Vulgate = 12.0.0.0, Culturae = neutra, PublicKeyToken = 71e9bce111e9429c" %> <%@ Register Tagprefix="SharePoint" Spatium nominale="Microsoft.SharePoint.WebControls" Conventu="Microsoft.SharePoint, Vulgate = 12.0.0.0, Culturae = neutra, PublicKeyToken = 71e9bce111e9429c" %>
<SharePoint:Reddendo Template ID="XYZZYCorporateLocationFieldControl" runat="server">
<Template>
<áspidis:DropDownList ID="XYZZYCorporateLocationSelector" runat="server" />
</Template>
</
SharePoint:Reddendo Template>

Salvatus est in superioribus c:\progressio lima communem lima Microsoft communes meaning Maecenas lobortis XII controltemplates.

  1. Tandem, nos creare XML file salvare in ..... XII XML album. Hoc est quod diffinit CAML pro nostro more et exemplo meo notitia typus, Videntur haec:

<?XML version="1.0" Encoding="utf-VIII" ?>
<
FieldTypes>
<
FieldType>
<
Agrum Nomen="TypeName">CorporateLocations</Agrum>
<
Agrum Nomen="ParentType">Text</Agrum>
<
Agrum Nomen="TypeDisplayName">Corporate Locations</Agrum>
<
Agrum Nomen="TypeShortDescription">All XYZZY Corporate locations including manufacturing or other facilities.</Agrum>
<
Agrum Nomen="UserCreatable">LEGITIMUS</Agrum>
<
Agrum Nomen="ShowInListCreate">LEGITIMUS</Agrum>
<
Agrum Nomen="ShowInDocumentLibraryCreate">LEGITIMUS</Agrum>
<
Agrum Nomen="ShowInSurveyCreate">LEGITIMUS</Agrum>
<
Agrum Nomen="ShowInColumnTemplateCreate">LEGITIMUS</Agrum>
<
Agrum Nomen="FieldTypeClass">Conchango.XYZZYCorporateLocationField, XYZZYCorporateLocationField, Version = 1.0.0.0, Culturae = neutra, PublicKeyToken=b0b19e85410990c4</Agrum>
<
RenderPattern Nomen="DisplayPattern">
<
Switch>
<
Expr>
<
Column />
</
Expr>

<Case Valor=""/>

<Default>
<
HTML>
<![CDATA[
<span style="color:Red"><b>]]>
</
HTML>

<
Column SubcolumnNumber="0" HTMLEncode="LEGITIMUS"/>

<HTML><![CDATA[</b></span>]]></HTML>

</
Default>
</
Switch>

</
RenderPattern>
</
FieldType>
</
FieldTypes>
This XML file adds the custom data type to the WSS "library" et aequet illam adversum GAC'd contione.

Hisce omnibus post movens in loco, iisreset in servo, et omnes satus opus nicely.

3 cogitationes on "MUSCUS: Donec eget - Consuetudo notitia typus

  1. Alexandrum
    HI Paulus,
    Primi omnium, gratias articulum, quoniam suus 'valde interesting. Una quaestio;
    Scis si suus posible reddere recte consuetudo agro typus in album visum datasheet?
    Quia omnis consuetudo agro typus ego creo suus ostenditur legere-solum in conspectum datasheet (et MSDN, enim, non auxilium me valde :-S).
    Gratias
  2. Lyndsay

    I am attempting to implement your solution. However I instead of DropDownList, I only have the option for a DropDownChoiceList. Do you happen to know how to add items to a DropDownChoiceList? Utemur SharePoint 2007 SP1 et Visual Bulla 2005 SP1.

Aliquam

Tua inscriptio electronica non editis. Velit sunt insignis *