Adding Contacts Android 2.3 rawContactId - rawcontacts

I'm new to java and developing apps, I can't figure out how to add a contact. I'm taking right from the android development website:
ContentValues values = new ContentValues();
values.put(Data.RAW_CONTACT_ID, rawContactId);
values.put(Data.MIMETYPE, Phone.CONTENT_ITEM_TYPE);
values.put(Phone.NUMBER, "1-800-GOOG-411");
values.put(Phone.TYPE, Phone.TYPE_CUSTOM);
values.put(Phone.LABEL, "free directory assistance");
Uri dataUri = getContentResolver().insert(Data.CONTENT_URI, values);
My question is: what do you put in the place of rawContactId? Is it supposed to be the name of the contact? I want to move on to the newer way to add contacts below, but I can't even get the "traditional" way to work. Help?
ArrayList<ContentProviderOperation> ops = new ArrayList<>();
ops.add(ContentProviderOperation.newInsert(Data.CONTENT_URI)
.withValue(Data.RAW_CONTACT_ID, rawContactId)
.withValue(Data.MIMETYPE, Phone.CONTENT_ITEM_TYPE)
.withValue(Phone.NUMBER, "1-800-GOOG-411")
.withValue(Phone.TYPE, Phone.TYPE_CUSTOM)
.withValue(Phone.LABEL, "free directory assistance")
.build());
getContentResolver().applyBatch(ContactsContract.AUTHORITY, ops);

Related

Removing collaborations from a user's account

We have a use case where we would like to remove a user's account in our enterprise. As part of the removal process we want to uncolloborate all of the folders the user owns but is sharing with others. I"m able to remove the user successfully but am stuck trying to uncolloborate all of the folders before removing their account. I've tried the following code but it doesn't seem to work. This is the code I'm using
List<BoxCollaboration> collabs = client.getFoldersManager()
.getFolderCollaborations(entry.getId(),
new BoxDefaultRequestObject());
for (BoxCollaboration collab : collabs) {
BoxUser collaboratorid = (BoxUser) collab.getAccessibleBy();
BoxDefaultRequestObject requestObject = new BoxDefaultRequestObject();
requestObject.getRequestExtras().addHeader("As-User", userwhoisgettingremived.getId());
client.getCollaborationsManager().deleteCollaboration(collaboratorid , requestObject);
}
Anyone have a suggestion of what else I can try.
Thanks in advance
Bill.
You don't need to use "As-User" header as now you are not acting as this user. So the code can be:
for (BoxCollaboration collab : collabs) {
String collaboratorid = collab.getId();
client.getCollaborationsManager().deleteCollaboration(collaboratorid , null);
}
OK I fixed this by adding the id of the Collaboration instead of the id of the user associated with the collaboration. so the deleteCollaboration line of code needed to be changed to
client.getCollaborationsManager().deleteCollaboration(collab.getId() , requestObject);

'Pin To Start' custom tile

When a user 'Pins To Start' on their wp8 / wp8.1 phone, how can I change the image that is saved as the live tile? Can I modify this?
I am guessing there is some sort of meta-tag or something that I am not aware of.
EDIT Sorry, i really should have clarified, this is for when you pin to start a web-page and it appears in the start menu. I was sure there was a meta tag that went into the section that solved it. Or is it something to do with Favicon?
May be you can try this ,This is for pinning a secondary tile.I am unsure of the possibility for changing the image in primary tile
StandardTileData standardTileData = new StandardTileData();
standardTileData.BackgroundImage = new Uri("ApplicationIcon.png", UriKind.Relative);
standardTileData.Title = "Your title";
standardTileData.Count = 26;
standardTileData.BackTitle = "Pinned";
standardTileData.BackContent = "Tile";
standardTileData.BackBackgroundImage = "Your image URL";
ShellTile tiletopin = ShellTile.ActiveTiles.FirstOrDefault(x => x.NavigationUri.ToString().Contains("MainPage.xaml"));
if (tiletopin == null)
{
ShellTile.Create(new Uri("/MainPage.xaml", UriKind.Relative), standardTileData);
}
else
{
MessageBox.Show("Already Pinned");
}
To change the Images on the pinned tile you need to update the images in the WMAppManifest.xml file.
Open the WMAppManifest.xml file present in Properties in Solution Explorer:
Once you Open the file Go to Application UI Tab and update the icons for small, Medium and Large size. The Icon that comes up when you pin the Application icon is The Medium Icon. So that will come up:

Highlight SimpleMarkerSymbol when item on data grid is clicked (ArcGis - esri)

Ideally what I'd like to happen is when an item from the data grid is clicked, the corresponding map icon would get a "halo" around it making it stand out from the other markers.
This is what I have based on Esri's exmaples but I'm missing something...
var sms = new esri.symbol.SimpleMarkerSymbol(
esri.symbol.SimpleMarkerSymbol.STYLE_CIRCLE,
new esri.symbol.SimpleLineSymbol(
esri.symbol.SimpleLineSymbol.STYLE_SOLID,
new dojo.Color([111, 0, 255]),
2
),
new dojo.Color([111, 0, 255, 0.15])
);
this.map.graphics.add(new esri.Graphic(data.geometry, sms, { "type": "parcel-highlight" }));
I'm wondering if I'm using the wrong method here to accomplish what I'm trying to accomplish. There are no errors generated - the desired effect just isn't happening is all (well, nothing is happening actually).
I was able to speak to the original developer who pointed me to the Esri legacy samples which provided the syntax for what I was trying to do.
var symbol = new esri.symbol.SimpleMarkerSymbol(esri.symbol.SimpleMarkerSymbol.STYLE_SQUARE, 10,
new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID,
new dojo.Color([255,0,0]), 1),
new dojo.Color([0,255,0,0.25]));
App.map.graphics.add(new esri.Graphic(queryResults[0].feature.geometry, symbol));
App.vent.trigger('Search:ShowIdentifyResult', [queryResults.features[0]]);

How to set the contact title using the EWS Java API (Exchange Web Service)?

I would like to achieve the exact same thing as asked in this question, but in java: How to set the contact title using Exchange Web Services Managed API
I am using the EWS Java API 1.2 (http://archive.msdn.microsoft.com/ewsjavaapi).
I can create a contact with all fields exposed in the API, but not the title (or Email1DisplayName). I tried these combinations (no errors, but title remains empty in the created contact when looking at it in Outlook):
contact.setExtendedProperty(new ExtendedPropertyDefinition(UUID.fromString("00062004-0000-0000-C000-000000000046"), 0x3A45, MapiPropertyType.String), value);
contact.setExtendedProperty(new ExtendedPropertyDefinition((UUID) null, 0x3A45, MapiPropertyType.String), value);
contact.setExtendedProperty(new ExtendedPropertyDefinition(0x3A45, MapiPropertyType.String), value);
Ok I don't know what I did wrong before, but one of the options in my question does work for the title. Here's the complete example code (I wish I had that before):
ExchangeService mailbox = new ExchangeService(ExchangeVersion.Exchange2007_SP1);
mailbox.setUrl(new URL("https://remote.domain.com/EWS/exchange.asmx").toURI());
ExchangeCredentials credentials = new WebCredentials("user.name", "password", "domain");
mailbox.setCredentials(credentials);
ExtendedPropertyDefinition titlePropDef = new ExtendedPropertyDefinition(0x3A45, MapiPropertyType.String);
Contact c = new Contact(mailbox);
c.setGivenName("GivenName");
c.setSurname("Surname");
c.getEmailAddresses().setEmailAddress(EmailAddressKey.EmailAddress1, new EmailAddress("asdf#asdf.com"));
c.setExtendedProperty(titlePropDef, "TitleXYZ");
c.save(WellKnownFolderName.Contacts);
Contact result = (Contact) mailbox.findItems(WellKnownFolderName.Contacts, new ItemView(1)).iterator().next();
PropertySet propertySet = new PropertySet(BasePropertySet.FirstClassProperties);
propertySet.add(titlePropDef);
result = Contact.bind(mailbox, result.getId(), propertySet);
System.out.println("count: " + result.getExtendedProperties().getCount());
for(ExtendedProperty p : result.getExtendedProperties())
{
System.out.println(p.toString());
}

How to remove default links from SharePoint 2013 suite bar and add my own links

I have a requirement where I need to remove or hide the default links displayed in Suite Bar like NewsFeed, SkyDrive, Sites etc. I want to add my own links and use this section as my Menu.
So while adding I want the items to be easily configurable by content editors. They can edit the links that needs to be shown and control the order. No hard coding of links.
If someone can help in this.
Regards,
navish
This can be done by oevrriding Delegate controls that displays these links. The below links will help
http://www.learningsharepoint.com/2013/02/10/addremove-links-in-top-suitebar-skydrivesitesnewsfeed-in-sharepoint-2013/
You should create a custom delegate control that target the SuiteLinksDelegate ControlId.
Add it to a Farm-scoped feature to make the custom delegate control active in the whole farm.
If you do not like hard-coded links you can program against a custom SharePoint list that stores the configurable links.
To Add custom links you can use the approach described here: http://zimmergren.net/technical/sp-2013-some-new-delegatecontrol-additions-to-the-sharepoint-2013-master-pages
If you need to remove some built-in links while keeping others (I had this requirement) you can use code like this:
public partial class SuiteLinksDelegate : MySuiteLinksUserControl
{
protected override void Render(HtmlTextWriter writer)
{
// save for later
var httpwriter = (writer.InnerWriter as HttpWriter);
// hijack the innerwriter
var sb = new StringBuilder();
var sw = new StringWriter(sb);
var tw = new HtmlTextWriter(sw);
writer.InnerWriter = tw;
// call base
base.Render(writer);
// get the html
var currentHtml = sb.ToString();
XElement element = XElement.Parse(currentHtml);
// remove SkyDrive link
var suiteLinkNodes = element.Elements("li").ToArray();
var remainingNodes = suiteLinkNodes.Where(node => !(node.ToString().Contains("ShellDocuments")));
element.ReplaceNodes(remainingNodes);
var modifiedHTML = element.ToString();
// set back the old innerwriter
writer.InnerWriter = httpwriter;
// write delegate control html
httpwriter.Write(modifiedHTML);
}
}
You can use javascript approach to hide this links as described in below link
http://www.tuyrcorp.com/sharepoint-2013-top-links-name-id-and-how-to-hide-them/
you can also add new item in the dropdown using this same javascript as well
Hope this helps
Thanks