<ItemGroup> <Docs Include="docs\*.*" /> </ItemGroup> <WriteLinesToFile File="DocumentNotInPdf.txt" Condition="!$(LinesFromReadFile.Contains('%(Docs.FileName)'))" Lines="%(Docs.FileName)%(Docs.Extension) "/> <ReadLinesFromFile File="DocumentNotInPdf.txt"> <Output TaskParameter="Lines" PropertyName="DocNoPdf"/> </ReadLinesFromFile> <MSBuild.Community.Tasks.Mail Condition="Exists('DocumentNotInPdf.txt')" SmtpServer="smtp" To="" From="" Subject="CheckDocToPdf" Body="Files not in docToPdf121.bat - $(DocNoPdf)." />
some.code.snippets
snippets to remind myself of how things work (or not)
Monday, 7 January 2013
Conditional String Concat
I was unable to find a way to allow conditional concat of strings, thus had to resort to the following
Labels:
MSBUILD
Wednesday, 27 June 2012
Clear Team Site home.aspx by c# code
Here's how you clear the home.aspx page of a default Team Site programmatically
public void clearContentOnMain() { try { using (SPSite site = new SPSite(TEAMSITEURL)) { using (SPWeb web = site.OpenWeb()) { SPFile homePage = web.GetFile("SitePages/Home.aspx"); if (homePage.Exists) { homePage.Item[SPBuiltInFieldId.WikiField] = ""; homePage.Item.Update(); } } } } catch (Exception ex) { throw new SPException("Error getting SitePages/Home.aspx " + ex.ToString()); } }
Labels:
SharePoint Misc
Tuesday, 26 June 2012
User vs UserMulti
I spent almost a whole day trying to figure out why ViewFieldsOverride only imports the UserName of AssignedTo field in Content Query Web Part.
After trying various ways and banging my head against the table, it turns out that by changing Type="UserMulti" from Type="User", AssignedTo field will have the format 'ID;#UserName'.
Friday, 8 June 2012
Add Presence Icon to SPGridview
I spent hours trying to figure out why my presence image only appears for the last instance of the particular user, and I finally figured out why, id has to be unique.
to show image presence, I attached to rowdatabound event with the required javascript
The lack of distinct ID causes some presence icon to disappear, that is, if user Andy is on two of the rows, the presence icon only appears for the last row where Andy is in.
to show image presence, I attached to rowdatabound event with the required javascript
protected void gvProjOverview_RowDataBound(object sender, GridViewRowEventArgs e)
{
if(e.Row.DataItem!=null)
{
SPWeb web = SPContext.Current.Web;
SPUser user = web.EnsureUser("DOMAIN\login");
e.Row.Cells[4].Text = ""
+ " "
+ ""
+ "" + user.Name + ""
+ "";
}
}
id='imn_" + e.Row.RowIndex <- this was where I had used user.ID which was not unique and thus the presence icon was only showing for one of the available users.
The lack of distinct ID causes some presence icon to disappear, that is, if user Andy is on two of the rows, the presence icon only appears for the last row where Andy is in.
Labels:
Error,
SPGridView
Subscribe to:
Posts (Atom)