Tuesday, June 30, 2015

CreateTerm / CreateLabel error

in sharepoint 2013 taxonomy, i tried to add terms to an existing TermSet.
the code i used gave me an arror

                string example = txtExample.Text;
                Term t = selectedT.CreateTerm(example, 1037);
                t.CreateLabel(example, 1037, true);

where selectedT is just another term.

the error i got
"Violation of PRIMARY KEY constraint IX_ECMTermLabel_PartitionIdTermIdLCIDLabel Cannot insert duplicate key in object dbo.ECMTermLabel The duplicate key value is (0c37852b-34d0-418e-91c6-2ac25af4be5b, 607, 1037, 33)"

the solution was NOT using CreateLabel.

Sunday, June 14, 2015

simple light box directive for angular

improved to 2 modes, simple that knows to listen to parent click, no configuration needed.

2nd mode with some config to enable modal like workflow.

here is the git
here is the plunker


Tuesday, June 9, 2015

Sharepoint GetList or GetListFromUrl fails (0x80070001 or 0x80004005)

maybe it looks like this
 Microsoft.SharePoint.SPException ---> System.Runtime.InteropServices.COMException: <nativehr>0x80070001</nativehr><nativestack></nativestack>

anyway, the problem might be that you changed context, you're in a handler (Ajax request), or moved references of SPContext or SPSite to a mehtod, or opened a new site and web.

the 2 methods above, GetList or GetListFromUrl, usually will work with non-100%-complete parameters, like "/Pages", but with the context a bit changed it must have the 100% parameters.

the GetListFromUrl just need "/Forms/AllItems.aspx" in the end, while the GetList need the full url, so try this:

web.GetList[site.MakeFullUrl("url part")]

and if your "url part" is just "/Pages" add web url like this:

web.GetList[site.MakeFullUrl(web.ServerRelativeUr + "url part")]